emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 8ec328e827 1/3: org-log-beginning: Fix for headline


From: ELPA Syncer
Subject: [elpa] externals/org 8ec328e827 1/3: org-log-beginning: Fix for headline at eob with no trailing newline
Date: Tue, 13 Sep 2022 10:57:58 -0400 (EDT)

branch: externals/org
commit 8ec328e827edf67a09b6612ae32aba79ceb98e9f
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-log-beginning: Fix for headline at eob with no trailing newline
    
    * lisp/org.el (org-log-beginning): Fix edge case when there is a
    headline at the end of buffer and that headline does not have a
    trailing newline.
    
    Fixes https://orgmode.org/list/m24k0ffjyd.fsf@ntnu.no
---
 lisp/org.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 49cace624e..f2444e0c3b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10311,12 +10311,17 @@ narrowing."
           (end-of-line -1))))
       (t
        (org-end-of-meta-data org-log-state-notes-insert-after-drawers)
-       (skip-chars-forward " \t\n")
-       (beginning-of-line)
-       (unless org-log-states-order-reversed
-        (org-skip-over-state-notes)
-        (skip-chars-backward " \t\n")
-        (beginning-of-line 2)))))
+       (let ((endpos (point)))
+         (skip-chars-forward " \t\n")
+         (beginning-of-line)
+         (unless org-log-states-order-reversed
+          (org-skip-over-state-notes)
+          (skip-chars-backward " \t\n")
+          (beginning-of-line 2))
+         ;; When current headline is at the end of buffer and does not
+         ;; end with trailing newline the above can move to the
+         ;; beginning of the headline.
+         (when (< (point) endpos)) (goto-char endpos)))))
    (if (bolp) (point) (line-beginning-position 2))))
 
 (defun org-add-log-setup (&optional purpose state prev-state how extra)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]