I'm looking for the cleanest way to have a language agnostic keybinding that will insert my initials + formatted timestamp e.g.:
--<my initials> (28 Oct 2013 11:38:20 AM)
into an Emacs buffer, so that I can initial my comments. I know I could create a function and create a keybinding to call it, but I feel like Emacs probably has a de facto way to do stuff like this, presumedly through the use of macros.
F3 (start recording macro)
--AA
C-u M-!date
C-e (insert text, insert output fromdate
command)F4 (stop recording macro)
C-x C-k n
my-initial-timestamp
(name the macro)C-x C-k b
...
(bind the macro to an appropriate key combination)And finally, open
~/.emacs
and type C-u M-xinsert-kbd-macro
RETmy-initial-timestamp
, which will insert the Lisp code to recreate the macro and bind it to the same key at startup.