Created
June 27, 2021 14:08
-
-
Save jonkri/ed6a54b2e5e704574680ae60afba47e3 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
(defun today-anchor () | |
"Find or create an anchor for today's date" | |
;; (org-time-stamp-format) for an active time stamp | |
(setq date (format-time-string (org-time-stamp-format nil t) (current-time))) | |
(goto-char (point-min)) | |
(if (re-search-forward (format org-complex-heading-regexp-format (regexp-quote date)) nil t) | |
(goto-char (line-beginning-position)) | |
(goto-char (point-min)) | |
(next-line) | |
(or (bolp) (insert "\n")) | |
(insert "* " date "\n") | |
(beginning-of-line 0) | |
(org-end-of-subtree))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment