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