summary refs log tree commit diff stats
path: root/tag-emacs
diff options
context:
space:
mode:
authorAlan Pearce2014-06-08 15:01:49 +0100
committerAlan Pearce2014-06-08 15:01:49 +0100
commite84d46099500cc08c2accc8228a24062da680867 (patch)
treea94feedf8e787b4bd667514f3ce274dbdd82a963 /tag-emacs
parent3608af91ffe95569272d655b5fc111de60e446c6 (diff)
downloaddotfiles-e84d46099500cc08c2accc8228a24062da680867.tar.lz
dotfiles-e84d46099500cc08c2accc8228a24062da680867.tar.zst
dotfiles-e84d46099500cc08c2accc8228a24062da680867.zip
Emacs: Add command to insert date and time
Diffstat (limited to 'tag-emacs')
-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 176d6ee..5babb05 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