summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-06-08 15:01:49 +0100
committerAlan Pearce2014-06-08 15:01:49 +0100
commite84d46099500cc08c2accc8228a24062da680867 (patch)
treea94feedf8e787b4bd667514f3ce274dbdd82a963
parent3608af91ffe95569272d655b5fc111de60e446c6 (diff)
downloadnixfiles-e84d46099500cc08c2accc8228a24062da680867.tar.lz
nixfiles-e84d46099500cc08c2accc8228a24062da680867.tar.zst
nixfiles-e84d46099500cc08c2accc8228a24062da680867.zip
Emacs: Add command to insert date and time
-rw-r--r--tag-emacs/emacs.d/init.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 176d6ee8..5babb056 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -220,6 +220,14 @@
                  ((equal prefix '(16)) "%A, %d %B %Y"))))
     (insert (format-time-string format))))
 
+(defun insert-datetime (prefix)
+  "Insert the currrent date and time."
+  (interactive "P")
+  (let ((format (cond
+                 ((not prefix) "%Y-%m-%d %H:%M:%S")
+                 ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ"))))
+    (insert (format-time-string format))))
+
 ;;;; Directory browsing
 (req-package dired
   :config (progn