From 0db003d4427874d7f3128b37a4e2d1f123b926b2 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Thu, 24 Mar 2022 20:16:50 +0100 Subject: [PATCH] Try fixing adding note in headline update function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 … --- site-lisp/db-org.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index d2ee9d4..cc5640d 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -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)))