all repos — nixfiles @ ea157ffc4382057bd3f2e924e80866ebd2fd33d7

System and user configuration, managed by nix and home-manager

Emacs: add command to insert a formatted date

Alan Pearce
commit

ea157ffc4382057bd3f2e924e80866ebd2fd33d7

parent

018c54df934153322f82b1c1c500dce00c83979f

1 file changed, 10 insertions(+), 0 deletions(-)

jump to
M emacs/init.elemacs/init.el
@@ -306,6 +306,16 @@ :config (progn
(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