[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 70970dff8d: org-before-first-heading-p: Use cache a
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 70970dff8d: org-before-first-heading-p: Use cache and clarify docstring |
Date: |
Tue, 25 Jan 2022 09:57:42 -0500 (EST) |
branch: externals/org
commit 70970dff8d68f009947b2167c5b2bd886c6de984
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-before-first-heading-p: Use cache and clarify docstring
---
lisp/org.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 2d439cd05c..cb5d52c76e 100644
--- a/lisp/org.el
+++ b/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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 70970dff8d: org-before-first-heading-p: Use cache and clarify docstring,
ELPA Syncer <=