[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b6587090bf: Fix clobbering of match data in executable-set-magic
From: |
Lars Ingebrigtsen |
Subject: |
master b6587090bf: Fix clobbering of match data in executable-set-magic |
Date: |
Thu, 3 Mar 2022 09:43:49 -0500 (EST) |
branch: master
commit b6587090bfa192efc4db5ac181a9dfd5ee8c0c08
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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).
---
lisp/progmodes/executable.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index d7c093444e..670b6e7e89 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -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))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b6587090bf: Fix clobbering of match data in executable-set-magic,
Lars Ingebrigtsen <=