Kaynağa Gözat

org-agenda-get-sexps: Avoid excessive calls to `org-agenda-skip'

* lisp/org-agenda.el (org-agenda-get-sexps): Only check if entry
should be skipped on matching sexps, when `org-diary-sexp-entry'
returns non-nil.
Ihor Radchenko 2 yıl önce
ebeveyn
işleme
9bd8a99a6e
1 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 7 1
      lisp/org-agenda.el

+ 7 - 1
lisp/org-agenda.el

@@ -5913,7 +5913,11 @@ displayed in agenda view."
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
-	(org-agenda-skip (org-element-at-point))
+        ;; We do not run `org-agenda-skip' righ away because every single sexp
+        ;; in the buffer is matched here, unlike day-specific search
+        ;; in ordinary timestamps.  Most of the sexps will not match
+        ;; the agenda day and it is quicker to run `org-agenda-skip' only for
+        ;; matching sexps later on.
 	(setq beg (match-beginning 0))
 	(goto-char (1- (match-end 0)))
 	(setq b (point))
@@ -5929,6 +5933,8 @@ displayed in agenda view."
 			   ""))
 	(setq result (org-diary-sexp-entry sexp sexp-entry date))
 	(when result
+          ;; Only check if entry should be skipped on matching sexps.
+ 	  (org-agenda-skip (org-element-at-point))
 	  (setq marker (org-agenda-new-marker beg)
 		level (make-string (org-reduced-level (org-outline-level)) ? )
 		category (org-get-category beg)