Try fixing adding note in headline update function

Let's not try to use the Org mode functions to add notes, but instead do it
directly manually.  I hope this works better now …
This commit is contained in:
Daniel - 2022-03-24 20:16:50 +01:00
parent 470a4c2ebf
commit 0db003d442
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 9 additions and 6 deletions

View File

@ -716,14 +716,17 @@ Interactively query for HEADLINE when not provided."
(user-error "Point is before first headline, aborting")) (user-error "Point is before first headline, aborting"))
(let ((old-headline (org-entry-get (point) "ITEM"))) (let ((old-headline (org-entry-get (point) "ITEM")))
;; Update headline
(org-edit-headline new-headline) (org-edit-headline new-headline)
;; This simulates adding a note manually. I am not quite sure how ;; Store note manually (I tried using `org-add-log-note', but did not succeed …)
;; robust this is, but let's try it out. (goto-char (org-log-beginning 'create))
(org-add-note) (indent-according-to-mode)
(insert ; This goes into the *Org Note* buffer. (insert "- Note taken on ")
(format "Changed headline from: %s" old-headline)) (org-insert-time-stamp (current-time) t t)
(org-store-log-note)))) (insert " \\\\\n")
(indent-according-to-mode)
(insert (format " Changed headline from: %s\n" old-headline)))))
(when (derived-mode-p 'org-agenda-mode) (when (derived-mode-p 'org-agenda-mode)
(org-agenda-redo))) (org-agenda-redo)))