summaryrefslogtreecommitdiff
path: root/lisp/progmodes/executable.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-29 00:57:36 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-29 00:57:36 +0000
commit77f76e3e1b83c55e1a033aef28bce51e16b1612a (patch)
tree62387f524bd46b9a7bb3192c2ecc8a3f6ea1a8a0 /lisp/progmodes/executable.el
parentc4c7f54c6ad77009e46ea66f622ba700d0240127 (diff)
downloademacs-77f76e3e1b83c55e1a033aef28bce51e16b1612a.tar.gz
(executable-set-magic): Add space at end of line
if user says no to adding the shell's usual arguments. Don't clear the buffer's modified-flag.
Diffstat (limited to 'lisp/progmodes/executable.el')
-rw-r--r--lisp/progmodes/executable.el34
1 files changed, 21 insertions, 13 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index 8f1428001e1..0c0905fcd2b 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -197,24 +197,32 @@ executable."
(add-hook 'after-save-hook 'executable-chmod nil t)
(if (looking-at "#![ \t]*\\(.*\\)$")
(and (goto-char (match-beginning 1))
+ ;; If the line ends in a space,
+ ;; don't offer to change it.
+ (not (= (char-after (1- (match-end 1))) ?\ ))
(not (string= argument
(buffer-substring (point) (match-end 1))))
- (or (not executable-query) no-query-flag
- (save-window-excursion
- ;; Make buffer visible before question.
- (switch-to-buffer (current-buffer))
- (y-or-n-p (concat "Replace magic number by `"
- executable-prefix argument "'? "))))
- (progn
- (replace-match argument t t nil 1)
- (message "Magic number changed to `%s'"
- (concat executable-prefix argument))))
+ (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 (concat "Replace magic number by `"
+ executable-prefix argument "'? "))))
+ (progn
+ (replace-match argument t t nil 1)
+ (message "Magic number changed to `%s'"
+ (concat executable-prefix argument)))
+ ;; Add a space at the end of the line
+ ;; so we do not ask again about changing it.
+ (end-of-line)
+ (insert " ")))
(insert executable-prefix argument ?\n)
(message "Magic number changed to `%s'"
(concat executable-prefix argument)))
- (or insert-flag
- (eq executable-insert t)
- (set-buffer-modified-p buffer-modified-p)))))
+;;; (or insert-flag
+;;; (eq executable-insert t)
+;;; (set-buffer-modified-p buffer-modified-p))
+ )))
interpreter)