# HG changeset patch # User Karl Heuer # Date 837461873 0 # Node ID 4431e88ce8d23a284fa90fe01c37458e5d5a9c71 # Parent 46d74bda4351f015e820e2a5d2b991ec7077d58e (sh-mode): Call sh-set-shell only for a writable empty buffer. diff -r 46d74bda4351 -r 4431e88ce8d2 lisp/progmodes/sh-script.el --- 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)