You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most emacs language modes use M-; (command comment-dwim) to comment in/out blocks. verilog-mode adds the c-c c-c (verilog-comment-region) and c-c c-u verilog-uncomment-region) to comment out/in a region using a block comment.
Since it has both, I use the M-; for permanent/documentation comments and the c-c c-c for temporary/debugging comments.
Following up on that, I've added a couple of lines to verilog-comment-region:
(beginning-of-line)
(insert verilog-exclude-str-start)
(insert " ") ;; new code
(insert-date-and-time) ;; new code
(newline)
insert-date-and-time is my function (see below), but this could be any code to insert the date and time. This doesn't interfere with verilog-uncomment-region.
Please add this to verilog-mode if you don't have an issue with it.
David
(defun insert-date-and-time ()
"Insert current date and time at point, and newline if point is at beginning of line."
(interactive)
(if (prog1 (bolp)
(let ((time (current-time-string)))
(insert (substring time 4 11) (substring time 20 24) (substring time 10 19) )))
;; insert newline if point was at beginning of line
(insert ?\n)))
The text was updated successfully, but these errors were encountered:
Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-05-19T11:22:42Z
I can see how you find this useful, but unless I'm missing something, existing modes don't add the date when commenting regions, and this would change behavior, so this would likely be a change most users don't want. It seems best left as a personal library change. (Suggest make a new function, then bind keys to that, so you don't need to edit verilog-mode.)
Author Name: David Rogoff
Original Redmine Issue: 1310 from https://www.veripool.org
Hi.
Most emacs language modes use M-; (command comment-dwim) to comment in/out blocks. verilog-mode adds the c-c c-c (verilog-comment-region) and c-c c-u verilog-uncomment-region) to comment out/in a region using a block comment.
Since it has both, I use the M-; for permanent/documentation comments and the c-c c-c for temporary/debugging comments.
Following up on that, I've added a couple of lines to verilog-comment-region:
insert-date-and-time is my function (see below), but this could be any code to insert the date and time. This doesn't interfere with verilog-uncomment-region.
Please add this to verilog-mode if you don't have an issue with it.
David
The text was updated successfully, but these errors were encountered: