diff options
| author | Glenn Morris | 2013-09-11 22:32:57 -0700 |
|---|---|---|
| committer | Glenn Morris | 2013-09-11 22:32:57 -0700 |
| commit | 30213927b6eebe291cd425d5863f54bffe0b8a83 (patch) | |
| tree | a66f7b728c1ba3723a02d2b242cecf3660053bc4 /lisp/progmodes/executable.el | |
| parent | 170266d096bc4d0952bee907532d14503e882bf6 (diff) | |
| download | emacs-30213927b6eebe291cd425d5863f54bffe0b8a83.tar.gz emacs-30213927b6eebe291cd425d5863f54bffe0b8a83.zip | |
Use with-demoted-errors now that it can format any error messages
* dframe.el (dframe-timer-fn):
* files.el (dir-locals-read-from-file):
* mpc.el (mpc--status-timer-run, mpc--status-idle-timer-run, mpc-format):
* reveal.el (reveal-post-command):
* saveplace.el (load-save-place-alist-from-file):
* shell.el (shell-resync-dirs):
* w32-common-fns.el (x-get-selection-value):
* emacs-lisp/copyright.el (copyright-find-copyright):
* emacs-lisp/eldoc.el (eldoc-print-current-symbol-info):
* emulation/tpu-edt.el (tpu-copy-keyfile):
* play/bubbles.el (bubbles--mark-neighbourhood):
* progmodes/executable.el (executable-make-buffer-file-executable-if-script-p):
* term/pc-win.el (x-get-selection-value): Use with-demoted-errors.
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 | ||