فهرست منبع

org-log-beginning: Fix edge case when we create logbook at eob

* lisp/org.el (org-log-beginning): Fix edge case when current headline
is the last headline in the buffer and does not have a final newline.

Fixes https://orgmode.org/list/m21qvi8er5.fsf@ntnu.no
Ihor Radchenko 2 سال پیش
والد
کامیت
f8d740f707
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      lisp/org.el

+ 5 - 1
lisp/org.el

@@ -10296,12 +10296,16 @@ narrowing."
 		 (throw 'exit nil))))
 	   ;; No drawer found.  Create one, if permitted.
 	   (when create
+             ;; Unless current heading is the last heading in buffer
+             ;; and does not have a newline, `org-end-of-meta-data'
+             ;; should move us somewhere below the heading.
              ;; Avoid situation when we insert drawer right before
              ;; first "*".  Otherwise, if the previous heading is
              ;; folded, we are inserting after visible newline at
              ;; the end of the fold, thus breaking the fold
              ;; continuity.
-             (when (org-at-heading-p) (backward-char))
+             (unless (eobp)
+               (when (org-at-heading-p) (backward-char)))
              (org-fold-core-ignore-modifications
 	       (unless (bolp) (insert-and-inherit "\n"))
 	       (let ((beg (point)))