Commit 56632ce4 authored by Glenn Morris's avatar Glenn Morris

Small executable.el fix related to bug#9879.

* lisp/progmodes/executable.el
(executable-make-buffer-file-executable-if-script-p):
Handle file-modes returning nil.
parent d3cfca60
2011-11-14 Glenn Morris <rgm@gnu.org>
* progmodes/executable.el
(executable-make-buffer-file-executable-if-script-p):
Handle file-modes returning nil.
* mail/rmail.el (rmail-no-mail-p): Remove mode-line N/M indicator.
* mail/rmailsum.el (rmail-summary, rmail-new-summary)
......
......@@ -268,12 +268,16 @@ file modes."
(save-restriction
(widen)
(string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
(let* ((current-mode (file-modes (buffer-file-name)))
(add-mode (logand ?\111 (default-file-modes))))
(or (/= (logand ?\111 current-mode) 0)
(zerop add-mode)
(set-file-modes (buffer-file-name)
(logior current-mode add-mode))))))
(condition-case nil
(let* ((current-mode (file-modes (buffer-file-name)))
(add-mode (logand ?\111 (default-file-modes))))
(or (/= (logand ?\111 current-mode) 0)
(zerop add-mode)
(set-file-modes (buffer-file-name)
(logior current-mode add-mode))))
;; Eg file-modes can return nil (bug#9879). It should not,
;; in this context, but we should handle it all the same.
(error (message "Unable to make file executable")))))
(provide 'executable)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment