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"))
(let ((old-headline (org-entry-get (point) "ITEM")))
;; Update headline
(org-edit-headline new-headline)
;; This simulates adding a note manually. I am not quite sure how
;; robust this is, but let's try it out.
(org-add-note)
(insert ; This goes into the *Org Note* buffer.
(format "Changed headline from: %s" old-headline))
(org-store-log-note))))
;; Store note manually (I tried using `org-add-log-note', but did not succeed …)
(goto-char (org-log-beginning 'create))
(indent-according-to-mode)
(insert "- Note taken on ")
(org-insert-time-stamp (current-time) t t)
(insert " \\\\\n")
(indent-according-to-mode)
(insert (format " Changed headline from: %s\n" old-headline)))))
(when (derived-mode-p 'org-agenda-mode)
(org-agenda-redo)))