lisp/org.el: Small refactoring

* lisp/org.el (org--get-expected-indentation): Use
`org-element-lineage' to check whether the point is right at the
beginning of a logbook drawer.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
Link: https://orgmode.org/list/87pmygnr7h.fsf@localhost
This commit is contained in:
Bastien Guerry 2021-04-27 09:28:17 +02:00
parent 730a05f787
commit 26d1d29cf9
1 changed files with 2 additions and 5 deletions

View File

@ -18844,15 +18844,12 @@ ELEMENT."
((and
(eq org-adapt-indentation 'headline-data)
(or (memq type '(planning clock node-property property-drawer drawer))
;; FIXME: when storing a note in a LOGBOOK drawer,
;; 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))))))
(eq (org-element-type (car (org-element-lineage element))) 'drawer)))
(org--get-expected-indentation
(org-element-property :parent element) t))
((memq type '(headline inlinetask nil))