aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorDave Love <[email protected]>2000-06-09 09:59:41 +0000
committerDave Love <[email protected]>2000-06-09 09:59:41 +0000
commitcc7e1d188e2c0dec2a6f72c21bd79fdbd43bd10a (patch)
tree287309ab30206d5b12f465d34ced3dbcecf47566 /lisp/progmodes
parentd18f678bf008dc55d8089b88ae548196937670fb (diff)
(executable-make-buffer-file-executable-if-script-p): Renamed and
simplified.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/executable.el11
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index 433ec73041..df373ba67f 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -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)