changeset 15677:4431e88ce8d2

(sh-mode): Call sh-set-shell only for a writable empty buffer.
author Karl Heuer <kwzh@gnu.org>
date Mon, 15 Jul 1996 20:17:53 +0000
parents 46d74bda4351
children 7a25ca1a7d7d
files lisp/progmodes/sh-script.el
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/sh-script.el	Mon Jul 15 20:00:34 1996 +0000
+++ b/lisp/progmodes/sh-script.el	Mon Jul 15 20:17:53 1996 +0000
@@ -662,10 +662,9 @@
     ;; 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)