]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix the match data in elisp-outline-search.
authorJuri Linkov <juri@linkov.net>
Wed, 30 Apr 2025 17:34:52 +0000 (20:34 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 1 May 2025 08:32:13 +0000 (10:32 +0200)
* lisp/progmodes/elisp-mode.el (elisp-outline-search):
Add 'save-match-data' since 'syntax-ppss' garbles the match data.

(cherry picked from commit b06046edcfceb6ba426880444894373f21ea4a79)

lisp/progmodes/elisp-mode.el

index 74aa644d8f9cc7d14c1dc49e4b6462d77d410fe3..18e051eb75e5fa72ef4be2b0293b03bf6d0d565b 100644 (file)
@@ -299,10 +299,13 @@ Comments in the form will be lost."
            (save-excursion (not (nth 8 (syntax-ppss (match-beginning 0))))))
     (let ((search-success nil))
       (while (and (setq search-success
-                        (funcall (if backward #'re-search-backward #'re-search-forward)
+                        (funcall (if backward #'re-search-backward
+                                   #'re-search-forward)
                                  (concat "^\\(?:" outline-regexp "\\)")
                                  bound (if move 'move t)))
-                  (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))))
+                  (save-excursion
+                    (save-match-data
+                      (nth 8 (syntax-ppss (match-beginning 0)))))))
       search-success)))
 
 (defcustom emacs-lisp-mode-hook nil