]> git.eshelyaron.com Git - emacs.git/commitdiff
(executable-make-buffer-file-executable-if-script-p): Renamed and
authorDave Love <fx@gnu.org>
Fri, 9 Jun 2000 09:59:41 +0000 (09:59 +0000)
committerDave Love <fx@gnu.org>
Fri, 9 Jun 2000 09:59:41 +0000 (09:59 +0000)
simplified.

lisp/ChangeLog
lisp/progmodes/executable.el

index 33c5f78f5d144afbf194d8f2afadb42901097d54..abf1255da5a7513f4546e0516b0907bfc1e2bd78 100644 (file)
@@ -3,11 +3,11 @@
        * executable.el: Byte compile dynamic.
        (executable-insert): Change custom type.
        (executable-find): Add autoload cookie.
-       (make-buffer-file-executable-if-script-p): New function.  From
-       Noah Friedman.
+       (executable-make-buffer-file-executable-if-script-p): New
+       function.  After Noah Friedman.
 
        * files.el (after-save-hook): Customize, with
-       make-buffer-file-executable-if-script-p as an option.
+       executable-make-buffer-file-executable-if-script-p as an option.
 
 2000-06-09  Kenichi Handa  <handa@etl.go.jp>
 
index 433ec730416fe914f60d80ea408f7c54d8a50e5d..df373ba67fd194c95e6c2eed815d710dcc6c1888 100644 (file)
@@ -267,16 +267,13 @@ The magic number of such a command displays all lines but itself."
   (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)