Home | Links | Weblog

Tuesday, January 13, 2004
Found a nice little snippet of code to insert the time and date stamp into an file using emacs. The code is put into the .emacs file:

;; Insert time stamp
(defun insert-date ()
"Insert current date and time."
(interactive "*")
(insert (current-time-string)))

This code allows the use of ctrl-c ctrl-d to do the insertion at the cursor:

(global-set-key "\C-c\C-d" 'insert-current-date-time) ;^C^D - insert date-time

Comments: Post a Comment