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 <kris@kristofernelson.com>
Link: https://orgmode.org/list/766237934.317726.1715720181047@office.mailbox.org

TINYCHANGE
This commit is contained in:
Kris Nelson 2024-05-18 12:16:06 -06:00 committed by Ihor Radchenko
parent 5af0625113
commit c0b66bf9c1
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 3 deletions

View File

@ -10676,10 +10676,10 @@ narrowing."
(unless (bolp) (insert-and-inherit "\n")) (unless (bolp) (insert-and-inherit "\n"))
(let ((beg (point))) (let ((beg (point)))
(insert-and-inherit ":" drawer ":\n:END:") (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-indent-region beg (point))
(org-fold-region (line-end-position -1) (1- (point)) t 'drawer)))) (org-fold-region (line-end-position 0) (point) t 'drawer))))
(end-of-line -1)))) (end-of-line 0))))
(t (t
(org-end-of-meta-data org-log-state-notes-insert-after-drawers) (org-end-of-meta-data org-log-state-notes-insert-after-drawers)
(let ((endpos (point))) (let ((endpos (point)))