aboutsummaryrefslogtreecommitdiff
path: root/modules/prog-shell.el
diff options
context:
space:
mode:
Diffstat (limited to 'modules/prog-shell.el')
-rw-r--r--modules/prog-shell.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/prog-shell.el b/modules/prog-shell.el
index d7f97932b..3ed51da11 100644
--- a/modules/prog-shell.el
+++ b/modules/prog-shell.el
@@ -166,8 +166,12 @@ Overrides default prog-mode keybindings with shell-specific commands."
;; Automatically set execute permission on shell scripts with shebangs
(defun cj/make-script-executable ()
- "Make the current file executable if it has a shebang."
+ "Make the current file executable if it is a script buffer with a shebang.
+Runs from a global `after-save-hook', so it gates on `prog-mode': a shebang in a
+text, org, or fundamental-mode buffer (a script being read, quoted, or reviewed)
+is left alone rather than silently made executable."
(when (and buffer-file-name
+ (derived-mode-p 'prog-mode)
(not (file-executable-p buffer-file-name))
(save-excursion
(goto-char (point-min))