changeset 29530:2485d23636b2

(executable-make-buffer-file-executable-if-script-p): Renamed and simplified.
author Dave Love <fx@gnu.org>
date Fri, 09 Jun 2000 09:58:46 +0000
parents fd2ad6344dab
children 34f0173c7f77
files lisp/progmodes/executable.el
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/executable.el	Fri Jun 09 09:55:33 2000 +0000
+++ b/lisp/progmodes/executable.el	Fri Jun 09 09:58:46 2000 +0000
@@ -267,16 +267,13 @@
   (executable-set-magic executable-self-display "+2"))
 
 ;;;###autoload
-(defun make-buffer-file-executable-if-script-p ()
+(defun executable-make-buffer-file-executable-if-script-p ()
   "Make file executable according to umask if not already executable.
 If file already has any execute bits set at all, do not change existing
 file modes."
-  (and (save-excursion
-         (save-restriction
-           (widen)
-           (goto-char (point-min))
-           (save-match-data
-             (looking-at "^#!"))))
+  (and (save-restriction
+	 (widen)
+	 (string= "#!" (buffer-substring 1 3)))
        (let* ((current-mode (file-modes (buffer-file-name)))
               (add-mode (logand ?\111 (default-file-modes))))
          (or (/= (logand ?\111 current-mode) 0)