I want to add notes to a heading but instead of using org-add-note
, it should be possible to choose any date I want to have as time stamp.
I use notes partly as Diary so I want to be able to create an entry without having to manipulate it afterwards for the desired date.
I wrote this function to accomplish this:
(defun tietan/org-add-note-ts ()
(interactive)
(let ((date (org-read-date))(res)(inp))
(setq res (concat "- Note taken on <"
date
"> \\\\\n"
(tietan/simplified-read-mb-lines "Insert text (C-j to submit): ") ))
(setq res (replace-regexp-in-string (regexp-quote "\n") "\n " res nil 'literal))
(kill-new res)
))
Now the questions:
Is there a better way to achieve date selection for
org-add-note
? I still have to manually insert the output of this function into the org-heading.org-capture
would always need a specific configuration for that, which doesn't suit my wish to have it as a possible solution for multiple use cases.Which function could I use to get the same buffer input window you normally get with
org-add-note
?
Info:
I copied the multiline block prompt from here https://stackoverflow.com/a/17004260 and changed the name to better fit in my personal naming conventions
(defun tietan/simplified-read-mb-lines (prompt)
(let ((keymap (copy-keymap minibuffer-local-map)))
(define-key keymap (kbd "RET") 'newline)
(read-from-minibuffer prompt nil keymap)))