From 476f696af8921c4906525b46f4cc2928462313a2 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 26 Apr 2021 15:26:32 -0500 Subject: Add `acdw/insert-iso-date' Like `crux-insert-date', but I use ISO 8601. --- init.el | 3 ++- lisp/acdw.el | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index c65a3ea..3ff41b4 100644 --- a/init.el +++ b/init.el @@ -254,7 +254,8 @@ "C-c i" acdw/find-emacs-dotfiles "C-x k" acdw/kill-a-buffer) - (:leader "C-c" save-buffers-kill-emacs) + (:leader "C-c" save-buffers-kill-emacs + "t" acdw/insert-iso-date) ;;; Advice ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. diff --git a/lisp/acdw.el b/lisp/acdw.el index 9426117..96b69f9 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -169,6 +169,12 @@ Prompt only if there are unsaved changes." (16 (mapc 'kill-buffer (delq (current-buffer) (buffer-list))) (delete-other-windows)))) +(defun acdw/insert-iso-date (with-time) + "Insert the ISO-8601-formatted date, with optional time." + (interactive "P") + (let ((format (if with-time "%FT%T%z" "%F"))) + (insert (format-time-string format (current-time))))) + ;; Make `C-z' more useful (defvar acdw/leader -- cgit 1.4.1-21-gabe81