From 974a79086f8a787ca421aabccae4016a84aa2818 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 27 Jul 2021 11:50:08 +0800 Subject: new: insert time-stamp * text-conf.el (global-map): (durand-insert-timestamp): Add a function to insert timestamps and bind it to H-= in the global map. This is inspired by a similar function of Protesilaos. --- text-conf.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/text-conf.el b/text-conf.el index 6cd0d14..c25a2bf 100644 --- a/text-conf.el +++ b/text-conf.el @@ -111,5 +111,18 @@ Pass (- (prefix-numeric-value arg)) to `durand-next-page'." (define-key text-mode-map (vector ?\s-m) #'durand-previous-page) (define-key text-mode-map (vector ?\s-รน) #'durand-next-page) +;; Insert time stamps + +;;;###autoload +(defun durand-insert-timestamp (&optional arg) + "Insert the time stamp for now. +If ARG is non-nil, use a more verbose format." + (interactive "P") + (let ((time-format (cond (arg "%F %T.%6N") + ("%F")))) + (insert (format-time-string time-format)))) + +(define-key global-map (vector ?\H-=) #'durand-insert-timestamp) + (provide 'text-conf) ;;; text-conf.el ends here. -- cgit v1.2.3-18-g5258