From 165272e79b8c6e884d9a37cf6a071f478142a02b Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Sat, 20 May 2023 13:27:08 -0400 Subject: Add keybind to insert date/time at POINT --- init.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/init.el b/init.el index 5437cdf..69adffc 100644 --- a/init.el +++ b/init.el @@ -854,6 +854,23 @@ (global-set-key (kbd "C-") 'beginning-of-visual-line) +;; --------------------------------- +;; Insert date/time at POINT +;; ------------------------- +;; [YYYY-MM-DD HH:mm] +;; --------------------------------- + +(defvar mm/date-time-format "[%Y-%m-%d %H:%M]" + "Format of the date to insert with `mm/insert-date-time' function. See help of `format-time-string' for alternative formats.") + +(defun mm/insert-date-time () + "Insert the current date time in the format of `mm/date-time-format' at POINT." + (interactive) + (insert (format-time-string mm/date-time-format (current-time)))) +p +(global-set-key (kbd "C-c d") (lambda () (interactive) (mm/insert-date-time))) + + ;; --------------------------------- ;; Improved Help buffer ;; -------------------- -- cgit v1.2.3