aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/executable.el
diff options
context:
space:
mode:
authorStefan Monnier2003-05-18 21:37:23 +0000
committerStefan Monnier2003-05-18 21:37:23 +0000
commit1d88c1b3cd3ec303029eb5353b6d304b6b96b5a7 (patch)
tree78368d13cd9b8000fc0394fce820e52ffc935fa1 /lisp/progmodes/executable.el
parentf3e95b0df03eb4c321817f8e521c07d2c83d022d (diff)
downloademacs-1d88c1b3cd3ec303029eb5353b6d304b6b96b5a7.tar.gz
emacs-1d88c1b3cd3ec303029eb5353b6d304b6b96b5a7.zip
(executable-set-magic): Remove unused vars `point' and `buffer-modified-p'.
Diffstat (limited to 'lisp/progmodes/executable.el')
-rw-r--r--lisp/progmodes/executable.el54
1 files changed, 24 insertions, 30 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index b0b798c2970..4255cb973c4 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -1,6 +1,6 @@
1;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*- 1;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*-
2 2
3;; Copyright (C) 1994, 1995, 1996, 2000 by Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 2000, 2003 by Free Software Foundation, Inc.
4 4
5;; Author: Daniel Pfeiffer <occitan@esperanto.org> 5;; Author: Daniel Pfeiffer <occitan@esperanto.org>
6;; Keywords: languages, unix 6;; Keywords: languages, unix
@@ -227,34 +227,28 @@ executable."
227 (not (or insert-flag executable-insert)) 227 (not (or insert-flag executable-insert))
228 (> (point-min) 1) 228 (> (point-min) 1)
229 (save-excursion 229 (save-excursion
230 (let ((point (point-marker)) 230 (goto-char (point-min))
231 (buffer-modified-p (buffer-modified-p))) 231 (add-hook 'after-save-hook 'executable-chmod nil t)
232 (goto-char (point-min)) 232 (if (looking-at "#![ \t]*\\(.*\\)$")
233 (add-hook 'after-save-hook 'executable-chmod nil t) 233 (and (goto-char (match-beginning 1))
234 (if (looking-at "#![ \t]*\\(.*\\)$") 234 ;; If the line ends in a space,
235 (and (goto-char (match-beginning 1)) 235 ;; don't offer to change it.
236 ;; If the line ends in a space, 236 (not (= (char-after (1- (match-end 1))) ?\ ))
237 ;; don't offer to change it. 237 (not (string= argument
238 (not (= (char-after (1- (match-end 1))) ?\ )) 238 (buffer-substring (point) (match-end 1))))
239 (not (string= argument 239 (if (or (not executable-query) no-query-flag
240 (buffer-substring (point) (match-end 1)))) 240 (save-window-excursion
241 (if (or (not executable-query) no-query-flag 241 ;; Make buffer visible before question.
242 (save-window-excursion 242 (switch-to-buffer (current-buffer))
243 ;; Make buffer visible before question. 243 (y-or-n-p (concat "Replace magic number by `"
244 (switch-to-buffer (current-buffer)) 244 executable-prefix argument "'? "))))
245 (y-or-n-p (concat "Replace magic number by `" 245 (progn
246 executable-prefix argument "'? ")))) 246 (replace-match argument t t nil 1)
247 (progn 247 (message "Magic number changed to `%s'"
248 (replace-match argument t t nil 1) 248 (concat executable-prefix argument)))))
249 (message "Magic number changed to `%s'" 249 (insert executable-prefix argument ?\n)
250 (concat executable-prefix argument))))) 250 (message "Magic number changed to `%s'"
251 (insert executable-prefix argument ?\n) 251 (concat executable-prefix argument)))))
252 (message "Magic number changed to `%s'"
253 (concat executable-prefix argument)))
254;;; (or insert-flag
255;;; (eq executable-insert t)
256;;; (set-buffer-modified-p buffer-modified-p))
257 )))
258 interpreter) 252 interpreter)
259 253
260 254
@@ -276,7 +270,7 @@ file modes."
276 (and (>= (buffer-size) 2) 270 (and (>= (buffer-size) 2)
277 (save-restriction 271 (save-restriction
278 (widen) 272 (widen)
279 (string= "#!" (buffer-substring 1 3))) 273 (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
280 (let* ((current-mode (file-modes (buffer-file-name))) 274 (let* ((current-mode (file-modes (buffer-file-name)))
281 (add-mode (logand ?\111 (default-file-modes)))) 275 (add-mode (logand ?\111 (default-file-modes))))
282 (or (/= (logand ?\111 current-mode) 0) 276 (or (/= (logand ?\111 current-mode) 0)