From 57578ae5116aa2cce74f08ac4281a72b52e61d2d Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Thu, 16 Jun 2022 20:40:51 -0400 Subject: [org] Add `log-todo-creation-date` --- lisp/documents.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/documents.el b/lisp/documents.el index 4687ac3..e14aac7 100644 --- a/lisp/documents.el +++ b/lisp/documents.el @@ -90,7 +90,8 @@ :bind (:map org-mode-map ("C-c s" . org-goto) - ("C-c M-q" . auto-fill-mode)) + ("C-c M-q" . auto-fill-mode) + ("C-M-" . log-todo-creation-date)) ;; Global keybindings for my Org workflow. :bind @@ -262,6 +263,16 @@ Visits LINK, or if LINK names a subdirectory of (org-agenda-skip-function ,subtree-is-habit) (org-agenda-overriding-header "Week Ahead:")))) ((org-agenda-compact-blocks t))))))) + ;; Finctionality to add a `CREATED' property -- I don't need something so + ;; intrusive that it inserts it for every heading. I can use my own + ;; discretion. + (defun log-todo-creation-date (&rest ignore) + "Log TODO creation time in the property drawer under the key 'CREATED'." + (interactive) + (when (and (org-get-todo-state) + (not (org-entry-get nil "CREATED"))) + (org-entry-put nil "CREATED" (format-time-string (cdr org-time-stamp-formats))))) + ;; Patch in an offset for tag alignment. (Without this, they will warp in a ;; way which I do not like.) :config/el-patch -- cgit v1.3