Make org-(in)active-current-time-stamp work without loading org

This commit is contained in:
Gerard Vermeulen 2022-09-06 17:05:35 +02:00
parent 9d08d908ae
commit a044949c7d

View File

@ -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 <SPC>") #'org-inactive-current-time-stamp)
(define-key org-mode-map