diff options
author | Alan Pearce | 2013-05-28 21:05:51 +0100 |
---|---|---|
committer | Alan Pearce | 2013-05-28 21:05:51 +0100 |
commit | ea157ffc4382057bd3f2e924e80866ebd2fd33d7 (patch) | |
tree | 1f5ac8ccf86cb7cc06937c317cee7caeb2eac70e | |
parent | 018c54df934153322f82b1c1c500dce00c83979f (diff) | |
download | dotfiles-ea157ffc4382057bd3f2e924e80866ebd2fd33d7.tar.lz dotfiles-ea157ffc4382057bd3f2e924e80866ebd2fd33d7.tar.zst dotfiles-ea157ffc4382057bd3f2e924e80866ebd2fd33d7.zip |
Emacs: add command to insert a formatted date
-rw-r--r-- | emacs/init.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el index 30b4e6b..4941e36 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -306,6 +306,16 @@ Values: `desktop', `server', `laptop'") (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + two prefix arguments, write out the day and month name." + (interactive "P") + (let ((format (cond + ((not prefix) "%Y-%m-%d") + ((equal prefix '(4)) "%d/%m/%Y") + ((equal prefix '(16)) "%A, %d %B %Y")))) + (insert (format-time-string format)))) + ;;;; Directory browsing (use-package dired :defer t |