Mercurial > emacs
comparison lisp/progmodes/executable.el @ 15560:0ce70615b9e9
(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.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sat, 29 Jun 1996 00:57:36 +0000 |
| parents | 4f6baee20482 |
| children | 7a25ca1a7d7d |
comparison
equal
deleted
inserted
replaced
| 15559:8d8bf85d356a | 15560:0ce70615b9e9 |
|---|---|
| 195 (goto-char (point-min)) | 195 (goto-char (point-min)) |
| 196 (make-local-hook 'after-save-hook) | 196 (make-local-hook 'after-save-hook) |
| 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 |
| 221 | 229 |
| 222 ;;;###autoload | 230 ;;;###autoload |
