From 2c53fa24e2a7abfa73e070145365d89ad1197b8a Mon Sep 17 00:00:00 2001 From: Kris Nelson Date: Sat, 18 May 2024 12:16:06 -0600 Subject: [PATCH] org-log-beginning: Fix error creating LOGBOOK drawer at end of buffer * lisp/org.el (org-log-beginning): Fix regression after 288c7069c where "Error in post-command-hook (org-add-log-note): (end-of-buffer)" is displayed after creating the LOGBOOK drawer on a heading which is at the end of the buffer. Reported-by: Kris Nelson Link: https://orgmode.org/list/766237934.317726.1715720181047@office.mailbox.org --- lisp/org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 4342ddd73..5e9f479fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10676,10 +10676,10 @@ narrowing." (unless (bolp) (insert-and-inherit "\n")) (let ((beg (point))) (insert-and-inherit ":" drawer ":\n:END:") - (if (eolp) (forward-char) (insert "\n")) + (unless (eolp) (insert-and-inherit "\n") (backward-char)) (org-indent-region beg (point)) - (org-fold-region (line-end-position -1) (1- (point)) t 'drawer)))) - (end-of-line -1)))) + (org-fold-region (line-end-position 0) (point) t 'drawer)))) + (end-of-line 0)))) (t (org-end-of-meta-data org-log-state-notes-insert-after-drawers) (let ((endpos (point))) -- 2.45.1