Skip to content

Commit 0057cc2

Browse files
committed
Improve agenda performance
* lisp/org-agenda.el (org-agenda-skip): Make use of ELEMENT argument when calling `org-in-src-block-p'. (org-agenda-get-sexps): Pass actual element at point to `org-agenda-skip'. * lisp/org.el (org-end-of-subtree): Avoid unnecessary call to `org-back-to-heading-or-point-min' when ELEMENT is provided.
1 parent a526ea6 commit 0057cc2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lisp/org-agenda.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,7 +4226,7 @@ Optional argument ELEMENT contains element at point."
42264226
(and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global)
42274227
(org-agenda-skip-eval org-agenda-skip-function)))
42284228
(goto-char to))
4229-
(org-in-src-block-p t))
4229+
(org-in-src-block-p t element))
42304230
(throw :skip t))))
42314231

42324232
(defun org-agenda-skip-eval (form)
@@ -5910,7 +5910,7 @@ displayed in agenda view."
59105910
(goto-char (point-min))
59115911
(while (re-search-forward regexp nil t)
59125912
(catch :skip
5913-
(org-agenda-skip (org-element-lineage (org-element-at-point) '(headline inlinetask) 'with-self))
5913+
(org-agenda-skip (org-element-at-point))
59145914
(setq beg (match-beginning 0))
59155915
(goto-char (1- (match-end 0)))
59165916
(setq b (point))

lisp/org.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20365,7 +20365,9 @@ If there is no such heading, return nil."
2036520365
;; Furthermore, when used inside Org, finding the end of a large subtree
2036620366
;; with many children and grandchildren etc, this can be much faster
2036720367
;; than the outline version.
20368-
(org-back-to-heading-or-point-min invisible-ok)
20368+
(if element
20369+
(setq element (org-element-lineage element '(headline inlinetask) 'include-self))
20370+
(org-back-to-heading-or-point-min invisible-ok))
2036920371
(unless (and (org-element--cache-active-p)
2037020372
(let ((cached (or element (org-element-at-point nil t))))
2037120373
(and cached

0 commit comments

Comments
 (0)