diff options
| author | Dave Love | 2000-06-09 09:59:41 +0000 |
|---|---|---|
| committer | Dave Love | 2000-06-09 09:59:41 +0000 |
| commit | cc7e1d188e2c0dec2a6f72c21bd79fdbd43bd10a (patch) | |
| tree | 287309ab30206d5b12f465d34ced3dbcecf47566 | |
| parent | d18f678bf008dc55d8089b88ae548196937670fb (diff) | |
| download | emacs-cc7e1d188e2c0dec2a6f72c21bd79fdbd43bd10a.tar.gz emacs-cc7e1d188e2c0dec2a6f72c21bd79fdbd43bd10a.zip | |
(executable-make-buffer-file-executable-if-script-p): Renamed and
simplified.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/executable.el | 11 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 33c5f78f5d1..abf1255da5a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | * executable.el: Byte compile dynamic. | 3 | * executable.el: Byte compile dynamic. |
| 4 | (executable-insert): Change custom type. | 4 | (executable-insert): Change custom type. |
| 5 | (executable-find): Add autoload cookie. | 5 | (executable-find): Add autoload cookie. |
| 6 | (make-buffer-file-executable-if-script-p): New function. From | 6 | (executable-make-buffer-file-executable-if-script-p): New |
| 7 | Noah Friedman. | 7 | function. After Noah Friedman. |
| 8 | 8 | ||
| 9 | * files.el (after-save-hook): Customize, with | 9 | * files.el (after-save-hook): Customize, with |
| 10 | make-buffer-file-executable-if-script-p as an option. | 10 | executable-make-buffer-file-executable-if-script-p as an option. |
| 11 | 11 | ||
| 12 | 2000-06-09 Kenichi Handa <handa@etl.go.jp> | 12 | 2000-06-09 Kenichi Handa <handa@etl.go.jp> |
| 13 | 13 | ||
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." | |||
| 267 | (executable-set-magic executable-self-display "+2")) | 267 | (executable-set-magic executable-self-display "+2")) |
| 268 | 268 | ||
| 269 | ;;;###autoload | 269 | ;;;###autoload |
| 270 | (defun make-buffer-file-executable-if-script-p () | 270 | (defun executable-make-buffer-file-executable-if-script-p () |
| 271 | "Make file executable according to umask if not already executable. | 271 | "Make file executable according to umask if not already executable. |
| 272 | If file already has any execute bits set at all, do not change existing | 272 | If file already has any execute bits set at all, do not change existing |
| 273 | file modes." | 273 | file modes." |
| 274 | (and (save-excursion | 274 | (and (save-restriction |
| 275 | (save-restriction | 275 | (widen) |
| 276 | (widen) | 276 | (string= "#!" (buffer-substring 1 3))) |
| 277 | (goto-char (point-min)) | ||
| 278 | (save-match-data | ||
| 279 | (looking-at "^#!")))) | ||
| 280 | (let* ((current-mode (file-modes (buffer-file-name))) | 277 | (let* ((current-mode (file-modes (buffer-file-name))) |
| 281 | (add-mode (logand ?\111 (default-file-modes)))) | 278 | (add-mode (logand ?\111 (default-file-modes)))) |
| 282 | (or (/= (logand ?\111 current-mode) 0) | 279 | (or (/= (logand ?\111 current-mode) 0) |