mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-29 07:58:21 +00:00
org-before-first-heading-p: Use cache and clarify docstring
This commit is contained in:
parent
26decec006
commit
70970dff8d
15
lisp/org.el
15
lisp/org.el
@ -20742,11 +20742,16 @@ instead of back to heading."
|
||||
(org-back-to-heading invisible-ok)))
|
||||
|
||||
(defun org-before-first-heading-p ()
|
||||
"Before first heading?"
|
||||
(org-with-limited-levels
|
||||
(save-excursion
|
||||
(end-of-line)
|
||||
(null (re-search-backward org-outline-regexp-bol nil t)))))
|
||||
"Before first heading?
|
||||
Respect narrowing."
|
||||
(if (org-element--cache-active-p)
|
||||
(let ((cached-headline (org-element-lineage (org-element-at-point) '(headline) t)))
|
||||
(or (not cached-headline)
|
||||
(< (org-element-property :begin cached-headline) (point-min))))
|
||||
(org-with-limited-levels
|
||||
(save-excursion
|
||||
(end-of-line)
|
||||
(null (re-search-backward org-outline-regexp-bol nil t))))))
|
||||
|
||||
(defun org-at-heading-p (&optional _)
|
||||
"Non-nil when on a headline."
|
||||
|
Loading…
Reference in New Issue
Block a user