aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/executable.el
diff options
context:
space:
mode:
authorJoakim Verona2011-11-22 15:39:42 +0100
committerJoakim Verona2011-11-22 15:39:42 +0100
commit40bb789236e486a3f36eefb2840c293369ce2af3 (patch)
tree8e81d3aa5f232ec7f2c5187c683cb0998d2dc4e2 /lisp/progmodes/executable.el
parent62318aed495a48e24ff73fe79e420dd801df3189 (diff)
parenta8e1496d750ab0f571b3412ff61aaa4da640a036 (diff)
downloademacs-40bb789236e486a3f36eefb2840c293369ce2af3.tar.gz
emacs-40bb789236e486a3f36eefb2840c293369ce2af3.zip
upstream
Diffstat (limited to 'lisp/progmodes/executable.el')
-rw-r--r--lisp/progmodes/executable.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index d8133cb6b90..281fa3cef72 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -268,12 +268,16 @@ file modes."
268 (save-restriction 268 (save-restriction
269 (widen) 269 (widen)
270 (string= "#!" (buffer-substring (point-min) (+ 2 (point-min))))) 270 (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
271 (let* ((current-mode (file-modes (buffer-file-name))) 271 (condition-case nil
272 (add-mode (logand ?\111 (default-file-modes)))) 272 (let* ((current-mode (file-modes (buffer-file-name)))
273 (or (/= (logand ?\111 current-mode) 0) 273 (add-mode (logand ?\111 (default-file-modes))))
274 (zerop add-mode) 274 (or (/= (logand ?\111 current-mode) 0)
275 (set-file-modes (buffer-file-name) 275 (zerop add-mode)
276 (logior current-mode add-mode)))))) 276 (set-file-modes (buffer-file-name)
277 (logior current-mode add-mode))))
278 ;; Eg file-modes can return nil (bug#9879). It should not,
279 ;; in this context, but we should handle it all the same.
280 (error (message "Unable to make file executable")))))
277 281
278(provide 'executable) 282(provide 'executable)
279 283