emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 37a58cc6ee 094/101: org-agenda-skip: Do not alter m


From: ELPA Syncer
Subject: [elpa] externals/org 37a58cc6ee 094/101: org-agenda-skip: Do not alter match data
Date: Sat, 1 Jul 2023 09:59:17 -0400 (EDT)

branch: externals/org
commit 37a58cc6ee58f808dd196223a3427a6b2923b1c8
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-agenda-skip: Do not alter match data
    
    * lisp/org-agenda.el (org-agenda-skip): Never alter match-data.  The
    callers often use `re-search-forward' and do not expect the match data
    to be altered.
---
 lisp/org-agenda.el | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8f2ad5738c..89c10403bd 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4240,25 +4240,26 @@ Also moves point to the end of the skipped region, so 
that search can
 continue from there.
 
 Optional argument ELEMENT contains element at point."
-  (when (or
-         (if element
-             (org-element-type-p element 'comment)
-          (save-excursion
-             (goto-char (line-beginning-position))
-             (looking-at comment-start-skip)))
-        (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
-             (or (and (save-match-data (org-in-archived-heading-p nil element))
-                      (org-end-of-subtree t element))
-                 (and (member org-archive-tag org-file-tags)
-                      (goto-char (point-max)))))
-        (and org-agenda-skip-comment-trees
-              (org-in-commented-heading-p nil element)
-             (org-end-of-subtree t element))
-         (let ((to (or (org-agenda-skip-eval org-agenda-skip-function-global)
-                      (org-agenda-skip-eval org-agenda-skip-function))))
-           (and to (goto-char to)))
-        (org-in-src-block-p t element))
-    (throw :skip t)))
+  (save-match-data
+    (when (or
+           (if element
+               (org-element-type-p element 'comment)
+            (save-excursion
+               (goto-char (line-beginning-position))
+               (looking-at comment-start-skip)))
+          (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
+               (or (and (save-match-data (org-in-archived-heading-p nil 
element))
+                        (org-end-of-subtree t element))
+                   (and (member org-archive-tag org-file-tags)
+                        (goto-char (point-max)))))
+          (and org-agenda-skip-comment-trees
+                (org-in-commented-heading-p nil element)
+               (org-end-of-subtree t element))
+           (let ((to (or (org-agenda-skip-eval org-agenda-skip-function-global)
+                        (org-agenda-skip-eval org-agenda-skip-function))))
+             (and to (goto-char to)))
+          (org-in-src-block-p t element))
+      (throw :skip t))))
 
 (defun org-agenda-skip-eval (form)
   "If FORM is a function or a list, call (or eval) it and return the result.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]