* 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>
(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)