summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el10
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