diff options
| author | Richard M. Stallman | 1996-06-29 00:57:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-06-29 00:57:36 +0000 |
| commit | 77f76e3e1b83c55e1a033aef28bce51e16b1612a (patch) | |
| tree | 62387f524bd46b9a7bb3192c2ecc8a3f6ea1a8a0 /lisp/progmodes/executable.el | |
| parent | c4c7f54c6ad77009e46ea66f622ba700d0240127 (diff) | |
| download | emacs-77f76e3e1b83c55e1a033aef28bce51e16b1612a.tar.gz emacs-77f76e3e1b83c55e1a033aef28bce51e16b1612a.zip | |
(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.el | 34 |
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." | |||
| 197 | (add-hook 'after-save-hook 'executable-chmod nil t) | 197 | (add-hook 'after-save-hook 'executable-chmod nil t) |
| 198 | (if (looking-at "#![ \t]*\\(.*\\)$") | 198 | (if (looking-at "#![ \t]*\\(.*\\)$") |
| 199 | (and (goto-char (match-beginning 1)) | 199 | (and (goto-char (match-beginning 1)) |
| 200 | ;; If the line ends in a space, | ||
| 201 | ;; don't offer to change it. | ||
| 202 | (not (= (char-after (1- (match-end 1))) ?\ )) | ||
| 200 | (not (string= argument | 203 | (not (string= argument |
| 201 | (buffer-substring (point) (match-end 1)))) | 204 | (buffer-substring (point) (match-end 1)))) |
| 202 | (or (not executable-query) no-query-flag | 205 | (if (or (not executable-query) no-query-flag |
| 203 | (save-window-excursion | 206 | (save-window-excursion |
| 204 | ;; Make buffer visible before question. | 207 | ;; Make buffer visible before question. |
| 205 | (switch-to-buffer (current-buffer)) | 208 | (switch-to-buffer (current-buffer)) |
| 206 | (y-or-n-p (concat "Replace magic number by `" | 209 | (y-or-n-p (concat "Replace magic number by `" |
| 207 | executable-prefix argument "'? ")))) | 210 | executable-prefix argument "'? ")))) |
| 208 | (progn | 211 | (progn |
| 209 | (replace-match argument t t nil 1) | 212 | (replace-match argument t t nil 1) |
| 210 | (message "Magic number changed to `%s'" | 213 | (message "Magic number changed to `%s'" |
| 211 | (concat executable-prefix argument)))) | 214 | (concat executable-prefix argument))) |
| 215 | ;; Add a space at the end of the line | ||
| 216 | ;; so we do not ask again about changing it. | ||
| 217 | (end-of-line) | ||
| 218 | (insert " "))) | ||
| 212 | (insert executable-prefix argument ?\n) | 219 | (insert executable-prefix argument ?\n) |
| 213 | (message "Magic number changed to `%s'" | 220 | (message "Magic number changed to `%s'" |
| 214 | (concat executable-prefix argument))) | 221 | (concat executable-prefix argument))) |
| 215 | (or insert-flag | 222 | ;;; (or insert-flag |
| 216 | (eq executable-insert t) | 223 | ;;; (eq executable-insert t) |
| 217 | (set-buffer-modified-p buffer-modified-p))))) | 224 | ;;; (set-buffer-modified-p buffer-modified-p)) |
| 225 | ))) | ||
| 218 | interpreter) | 226 | interpreter) |
| 219 | 227 | ||
| 220 | 228 | ||