summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorJens Schmidt <jschmidt4gnu@vodafonemail.de>2023-09-26 21:36:19 +0200
committerEli Zaretskii <eliz@gnu.org>2023-10-14 11:01:52 +0300
commit115a940a4b1d28f18df5aa82a19fae9cbe67b869 (patch)
treeac3169e5da4565cce66d6efbd2fa2aa0f8bbcf3e /lisp/emacs-lisp
parent281258e5748385a01120cb3b7a90d9ce5f73e313 (diff)
downloademacs-115a940a4b1d28f18df5aa82a19fae9cbe67b869.tar.gz
emacs-115a940a4b1d28f18df5aa82a19fae9cbe67b869.tar.bz2
emacs-115a940a4b1d28f18df5aa82a19fae9cbe67b869.zip
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)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/lisp.el3
1 files changed, 2 insertions, 1 deletions
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)))