[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LOGBOOK drawer now being created with blank line afterwards
From: |
Kris Nelson |
Subject: |
Re: LOGBOOK drawer now being created with blank line afterwards |
Date: |
Thu, 16 May 2024 01:48:04 -0600 |
On 2024-05-15 02:38, Rens Oliemans wrote:
Thanks for reporting, it seems that this was changed in
f63ff074417315fcf93c2ca6cfe8f89fcc6d902f, "Fix subtle differences
between overlays and invisible text properties", bisected with Emacs
29.3.
Thanks, that definitely helps narrow it down! Seems to be a result of
this specific patch in the org-log-beginning function:
diff --git a/lisp/org.el b/lisp/org.el
index 4c87011..953f2f3 100644
--- a/lisp/org.el
<https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el?id=cd83606cfd8a52e7222a0deeeddb3af29e9cbfce>
+++ b/lisp/org.el
<https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el?id=f63ff074417315fcf93c2ca6cfe8f89fcc6d902f>
@@ -10020,13 +10031,19 @@ narrowing."
(throw 'exit nil))))
;; No drawer found. Create one, if permitted.
(when create
- (unless (bolp) (insert "\n"))
- (let ((beg (point)))
- (insert ":" drawer ":\n:END:\n")
- (org-indent-region beg (point))
- (org-flag-region (line-end-position -1)
- (1- (point)) t 'outline))
- (end-of-line -1)))))
+ ;; 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))
+ (org-fold-core-ignore-modifications
+ (unless (bolp) (insert-and-inherit "\n"))
+ (let ((beg (point)))
+ (insert-and-inherit ":" drawer ":\n:END:\n")
+ (org-indent-region beg (point))
+ (org-fold-region (line-end-position -1) (1- (point)) t (if
(eq org-fold-core-style 'text-properties) 'drawer 'outline)))))
+ (end-of-line -1))))
(t
(org-end-of-meta-data org-log-state-notes-insert-after-drawers)
(skip-chars-forward " \t\n")
I switched the (when create) section back to the previous state and
confirmed that when redoing my test scenario no blank line was left
after the logbook.
In the new code, I attempted just removing the final "\n" from
(insert-and-inherit ":" drawer ":\n:END:\n") but that resulted in some
weird behaviour when redoing my tests. I'll keep mucking with this to
see where I get.
To clarify, would this behaviour change be considered a bug? Or is this
intentional as a part of that patch, and I just need to figure out how
to change the behaviour for myself?