diff options
author | Dave Love <fx@gnu.org> | 2000-06-09 09:58:46 +0000 |
---|---|---|
committer | Dave Love <fx@gnu.org> | 2000-06-09 09:58:46 +0000 |
commit | 837fcf77d9080af13f6ae32c7fe97aba5ef22e75 (patch) | |
tree | b8134b192a714e3d70b7379fc3ad6b334e14ae18 /lisp/progmodes/executable.el | |
parent | 23cc4f5750997ce1d1409283517f20c8a998b253 (diff) | |
download | emacs-837fcf77d9080af13f6ae32c7fe97aba5ef22e75.tar.gz |
(executable-make-buffer-file-executable-if-script-p): Renamed and
simplified.
Diffstat (limited to 'lisp/progmodes/executable.el')
-rw-r--r-- | lisp/progmodes/executable.el | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index 433ec730416..df373ba67fd 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) |