diff options
| author | Kenichi Handa | 2013-09-12 23:48:18 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2013-09-12 23:48:18 +0900 |
| commit | 56d968a488c68563c5eae8264b7d3adfee9dc684 (patch) | |
| tree | 712adf1c2f7e12ac9d169958ea63760ad42fc6ce /lisp/progmodes/executable.el | |
| parent | b5623270b6047528786d4550cebe0b228ecadb6b (diff) | |
| parent | 4dfa4b9bd944fa385b248b5b0b56e95979119420 (diff) | |
| download | emacs-56d968a488c68563c5eae8264b7d3adfee9dc684.tar.gz emacs-56d968a488c68563c5eae8264b7d3adfee9dc684.zip | |
merge trunk
Diffstat (limited to 'lisp/progmodes/executable.el')
| -rw-r--r-- | lisp/progmodes/executable.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index a305393c7d8..7b08df8b85f 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el | |||
| @@ -269,16 +269,15 @@ file modes." | |||
| 269 | (save-restriction | 269 | (save-restriction |
| 270 | (widen) | 270 | (widen) |
| 271 | (string= "#!" (buffer-substring (point-min) (+ 2 (point-min))))) | 271 | (string= "#!" (buffer-substring (point-min) (+ 2 (point-min))))) |
| 272 | (condition-case nil | 272 | ;; Eg file-modes can return nil (bug#9879). It should not, |
| 273 | (let* ((current-mode (file-modes (buffer-file-name))) | 273 | ;; in this context, but we should handle it all the same. |
| 274 | (add-mode (logand ?\111 (default-file-modes)))) | 274 | (with-demoted-errors "Unable to make file executable: %s" |
| 275 | (or (/= (logand ?\111 current-mode) 0) | 275 | (let* ((current-mode (file-modes (buffer-file-name))) |
| 276 | (zerop add-mode) | 276 | (add-mode (logand ?\111 (default-file-modes)))) |
| 277 | (set-file-modes (buffer-file-name) | 277 | (or (/= (logand ?\111 current-mode) 0) |
| 278 | (logior current-mode add-mode)))) | 278 | (zerop add-mode) |
| 279 | ;; Eg file-modes can return nil (bug#9879). It should not, | 279 | (set-file-modes (buffer-file-name) |
| 280 | ;; in this context, but we should handle it all the same. | 280 | (logior current-mode add-mode))))))) |
| 281 | (error (message "Unable to make file executable"))))) | ||
| 282 | 281 | ||
| 283 | (provide 'executable) | 282 | (provide 'executable) |
| 284 | 283 | ||