Created
April 5, 2024 10:04
-
-
Save DivineDominion/a29203ace19a339f972b2c5b83e68ebd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar ct/org-created-property-name "CREATED" | |
"The name of the org-mode property that stores the creation date of the entry") | |
(defun ct/org-set-created-property (&optional active NAME) | |
"Set a property on the entry giving the creation time. | |
By default the property is called CREATED. If given the `NAME' | |
argument will be used instead. If the property already exists, it | |
will not be modified." | |
(interactive) | |
(let* ((created (or NAME ct/org-created-property-name)) | |
(fmt (if active "<%s>" "[%s]")) | |
(now (format fmt (format-time-string "%Y-%m-%d %a %H:%M")))) | |
(unless (org-entry-get (point) created nil) | |
(org-set-property created now)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment