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 "\\(\\)") (insert "\\(\\)")
(backward-char 2))) (backward-char 2)))
(with-eval-after-load 'org
(defun org-active-current-time-stamp () (defun org-active-current-time-stamp ()
"Insert an active date-time stamp of the current time." "Insert an active date-time stamp of the current time."
(interactive) (interactive)
(org-insert-time-stamp (current-time) 'with-hm)) (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 () (defun org-inactive-current-time-stamp ()
"Insert an inactive date-time stamp of the current time." "Insert an inactive date-time stamp of the current time."
(interactive) (interactive)
(org-insert-time-stamp (current-time) 'with-hm 'inactive)) (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
(define-key org-mode-map (define-key org-mode-map
(kbd "C-c <SPC>") #'org-inactive-current-time-stamp) (kbd "C-c <SPC>") #'org-inactive-current-time-stamp)
(define-key org-mode-map (define-key org-mode-map