emacs-diffs
[Top][All Lists]
Advanced

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

master 115a940a4b1: Fix beginning-of-defun not jumping to BOF


From: Eli Zaretskii
Subject: master 115a940a4b1: Fix beginning-of-defun not jumping to BOF
Date: Sat, 14 Oct 2023 04:03:07 -0400 (EDT)

branch: master
commit 115a940a4b1d28f18df5aa82a19fae9cbe67b869
Author: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix beginning-of-defun not jumping to BOF
    
    In batch mode or when font-lock and some other niceties are switched
    off, function `syntax-ppss' can modify match data held by function
    `beginning-of-defun-raw'.  In that case, `beginning-of-defun' can jump
    to some seemingly arbitrary position, and not the actual BOF.
    
    * lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Save match data
    around a call to `syntax-ppss'. (Bug#66218)
---
 lisp/emacs-lisp/lisp.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index a4aa79c171e..ee481dc4ed3 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -422,7 +422,8 @@ of a defun, nil if it failed to find one."
                                       "\\(?:" defun-prompt-regexp "\\)\\s(")
                             "^\\s(")
                                              nil 'move arg))
-                    (nth 8 (syntax-ppss))))
+                    (save-match-data
+                      (nth 8 (syntax-ppss)))))
            found)
         (progn (goto-char (1- (match-end 0)))
                 t)))



reply via email to

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