From 8fe836acc0609fe0921b1c5251dec397e9b5aafd Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 30 Apr 2025 20:34:52 +0300 Subject: [PATCH] Fix the match data in elisp-outline-search. * 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 74aa644d8f9..18e051eb75e 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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 -- 2.39.5