[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 2737128aa7 2/6: org-back-to-heading: Use cache
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 2737128aa7 2/6: org-back-to-heading: Use cache |
Date: |
Tue, 13 Sep 2022 09:58:01 -0400 (EDT) |
branch: externals/org
commit 2737128aa778297f41971cc93c464faf17718e34
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-back-to-heading: Use cache
* lisp/org.el (org-back-to-heading): Use element cache when cache is
active.
---
lisp/org.el | 63 ++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 41 insertions(+), 22 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index a70e5260c8..49cace624e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20022,28 +20022,47 @@ interactive command with similar behavior."
"Go back to beginning of heading."
(beginning-of-line)
(or (org-at-heading-p (not invisible-ok))
- (let (found)
- (save-excursion
- ;; At inlinetask end. Move to bol, so that the following
- ;; search goes to the beginning of the inlinetask.
- (when (and (featurep 'org-inlinetask)
- (fboundp 'org-inlinetask-end-p)
- (org-inlinetask-end-p))
- (goto-char (line-beginning-position)))
- (while (not found)
- (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
- nil t)
- (user-error "Before first headline at position %d in buffer %s"
- (point) (current-buffer)))
- ;; Skip inlinetask end.
- (if (and (featurep 'org-inlinetask)
- (fboundp 'org-inlinetask-end-p)
- (org-inlinetask-end-p))
- (org-inlinetask-goto-beginning)
- (setq found (and (or invisible-ok (not (org-fold-folded-p)))
- (point))))))
- (goto-char found)
- found)))
+ (if (org-element--cache-active-p)
+ (let ((heading (org-element-lineage (org-element-at-point)
+ '(headline inlinetask)
+ 'include-self)))
+ (when heading
+ (goto-char (org-element-property :begin heading)))
+ (while (and (not invisible-ok)
+ heading
+ (org-fold-folded-p))
+ (goto-char (org-fold-core-previous-visibility-change))
+ (setq heading (org-element-lineage (org-element-at-point)
+ '(headline inlinetask)
+ 'include-self))
+ (when heading
+ (goto-char (org-element-property :begin heading))))
+ (unless heading
+ (user-error "Before first headline at position %d in buffer %s"
+ (point) (current-buffer)))
+ (point))
+ (let (found)
+ (save-excursion
+ ;; At inlinetask end. Move to bol, so that the following
+ ;; search goes to the beginning of the inlinetask.
+ (when (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (goto-char (line-beginning-position)))
+ (while (not found)
+ (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+ nil t)
+ (user-error "Before first headline at position %d in buffer
%s"
+ (point) (current-buffer)))
+ ;; Skip inlinetask end.
+ (if (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (org-inlinetask-goto-beginning)
+ (setq found (and (or invisible-ok (not (org-fold-folded-p)))
+ (point))))))
+ (goto-char found)
+ found))))
(defun org-back-to-heading-or-point-min (&optional invisible-ok)
"Go back to heading or first point in buffer.
- [elpa] externals/org updated (0432f4fe6b -> 4fc2c8dd89), ELPA Syncer, 2022/09/13
- [elpa] externals/org 4d8c6fbf7a 1/6: org-up-heading-safe: Consider inlinetasks, ELPA Syncer, 2022/09/13
- [elpa] externals/org 543a23a57d 3/6: Revert "lisp/ol.el: Fix bug when storing links", ELPA Syncer, 2022/09/13
- [elpa] externals/org 4fc2c8dd89 6/6: org-store-link: Default to empty description for target/custom-id links, ELPA Syncer, 2022/09/13
- [elpa] externals/org f7b8510283 4/6: ol.el: Skip #CUSTOM_ID when <<target>> link is stored, ELPA Syncer, 2022/09/13
- [elpa] externals/org c3d6672cfd 5/6: ol.el: Avoid links like "[[target][file:~/org/test.org::target]]", ELPA Syncer, 2022/09/13
- [elpa] externals/org 2737128aa7 2/6: org-back-to-heading: Use cache,
ELPA Syncer <=