summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-07-15 20:17:53 +0000
committerKarl Heuer <kwzh@gnu.org>1996-07-15 20:17:53 +0000
commit1f84f78b3130b7dce859f060f5669d3db3ff0994 (patch)
treef0dace5590d15e367d23229508ff3f838c05e5e6
parentab54e45211a66f2a2f04b06a1929cb86f6950e71 (diff)
downloademacs-1f84f78b3130b7dce859f060f5669d3db3ff0994.tar.gz
(sh-mode): Call sh-set-shell only for a writable
empty buffer.
-rw-r--r--lisp/progmodes/sh-script.el7
1 files changed, 3 insertions, 4 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 51923ee2795..fbcdf5c8dbc 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -662,10 +662,9 @@ with your script for an edit-interpret-debug cycle."
;; parse or insert magic number for exec() and set all variables depending
;; on the shell thus determined
(goto-char (point-min))
- (sh-set-shell
- (if (looking-at "#![\t ]*\\([^\t\n ]+\\)")
- (match-string 1)
- sh-shell-file)))
+ (and (zerop (buffer-size))
+ (not buffer-read-only)
+ (sh-set-shell sh-shell-file)))
(run-hooks 'sh-mode-hook))
;;;###autoload
(defalias 'shell-script-mode 'sh-mode)