summaryrefslogtreecommitdiff
path: root/text-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-07-27 11:50:08 +0800
committerJSDurand <mmemmew@gmail.com>2021-07-27 11:50:08 +0800
commit974a79086f8a787ca421aabccae4016a84aa2818 (patch)
treece08bbfb1dabac3c80e837ff4a2606bee35d324c /text-conf.el
parent0652cf16507a17fa7058423ec5a7a23b0fa3cc68 (diff)
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.
Diffstat (limited to 'text-conf.el')
-rw-r--r--text-conf.el13
1 files changed, 13 insertions, 0 deletions
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.