[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org f8d740f707 2/3: org-log-beginning: Fix edge case wh
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org f8d740f707 2/3: org-log-beginning: Fix edge case when we create logbook at eob |
Date: |
Tue, 13 Sep 2022 10:57:58 -0400 (EDT) |
branch: externals/org
commit f8d740f707ceab1e865fd1745ffaaa531b9fdd0e
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
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
---
lisp/org.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index f2444e0c3b..5eb5b5d6c1 100644
--- a/lisp/org.el
+++ b/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)))