From a044949c7db32755776d23dee2cc9d68ee50c316 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Tue, 6 Sep 2022 17:05:35 +0200 Subject: [PATCH] Make org-(in)active-current-time-stamp work without loading org --- README.org | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index 2a89c7e..98dfab8 100644 --- a/README.org +++ b/README.org @@ -1965,17 +1965,25 @@ backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and ty (insert "\\(\\)") (backward-char 2))) + (defun org-active-current-time-stamp () + "Insert an active date-time stamp of the current time." + (interactive) + (if (fboundp 'org-insert-time-stamp) + (org-insert-time-stamp (current-time) 'with-hm) + (let ((stamp (format-time-string "<%Y-%m-%d %a %H:%M>" (current-time)))) + (insert stamp) + stamp))) + + (defun org-inactive-current-time-stamp () + "Insert an inactive date-time stamp of the current time." + (interactive) + (if (fboundp 'org-insert-time-stamp) + (org-insert-time-stamp (current-time) 'with-hm 'inactive) + (let ((stamp (format-time-string "[%Y-%m-%d %a %H:%M]" (current-time)))) + (insert stamp) + stamp))) + (with-eval-after-load 'org - (defun org-active-current-time-stamp () - "Insert an active date-time stamp of the current time." - (interactive) - (org-insert-time-stamp (current-time) 'with-hm)) - - (defun org-inactive-current-time-stamp () - "Insert an inactive date-time stamp of the current time." - (interactive) - (org-insert-time-stamp (current-time) 'with-hm 'inactive)) - (define-key org-mode-map (kbd "C-c ") #'org-inactive-current-time-stamp) (define-key org-mode-map