Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add date/time stamp to comment #1310

Closed
veripoolbot opened this issue May 17, 2018 · 1 comment
Closed

add date/time stamp to comment #1310

veripoolbot opened this issue May 17, 2018 · 1 comment
Labels

Comments

@veripoolbot
Copy link
Collaborator


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:

     (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)))

@veripoolbot
Copy link
Collaborator Author


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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant