org.el: Fix indentation of new notes in a logbook drawer

* lisp/org.el (org--get-expected-indentation): Fix indentation of
new notes in a logbook drawer when org-adapt-indentation is set to
'headline-data.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/878s9p4xtt.fsf@gnu.org/
This commit is contained in:
Bastien Guerry 2021-04-27 08:41:04 +02:00
parent 43f6ced0da
commit 730a05f787
1 changed files with 10 additions and 1 deletions

View File

@ -18843,7 +18843,16 @@ ELEMENT."
(current-indentation))))
((and
(eq org-adapt-indentation 'headline-data)
(memq type '(planning clock node-property property-drawer drawer)))
(or (memq type '(planning clock node-property property-drawer drawer))
;; FIXME: when storing a note in a LOGBOOK drawer,
;; `org-store-log-note' needs to insert a new line before
;; the newly inserted note, thus the `type' at point will
;; return `paragraph' instead of the expected `drawer', so
;; we need to manually detect the drawer.
(and (looking-at-p "^$")
(save-excursion
(backward-char)
(looking-back org-drawer-regexp (point-at-bol))))))
(org--get-expected-indentation
(org-element-property :parent element) t))
((memq type '(headline inlinetask nil))