mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
Fix clobbering of match data in executable-set-magic
* lisp/progmodes/executable.el (executable-set-magic): Switching buffers may clobber match data, so save the match data first (bug#54218).
This commit is contained in:
parent
d72cd4a2b7
commit
b6587090bf
1 changed files with 7 additions and 6 deletions
|
|
@ -240,12 +240,13 @@ executable."
|
|||
(not (string= argument
|
||||
(buffer-substring (point) (match-end 1))))
|
||||
(if (or (not executable-query) no-query-flag
|
||||
(save-window-excursion
|
||||
;; Make buffer visible before question.
|
||||
(switch-to-buffer (current-buffer))
|
||||
(y-or-n-p (format-message
|
||||
"Replace magic number by `#!%s'? "
|
||||
argument))))
|
||||
(save-match-data
|
||||
(save-window-excursion
|
||||
;; Make buffer visible before question.
|
||||
(switch-to-buffer (current-buffer))
|
||||
(y-or-n-p (format-message
|
||||
"Replace magic number by `#!%s'? "
|
||||
argument)))))
|
||||
(progn
|
||||
(replace-match argument t t nil 1)
|
||||
(message "Magic number changed to `#!%s'" argument))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue