changeset 16810:20dc495230a0

(sh-shell-file): On MSDOS, collapse $SHELL to lower case and remove the executable extension, if any. (sh-other-keywords): Define an entry for `sh' and make `bourne' inherit from that. (sh-mode): Always pass nil as 3rd arg to sh-set-shell.
author Richard M. Stallman <rms@gnu.org>
date Thu, 02 Jan 1997 02:51:05 +0000
parents c378600f005d
children df5765f5f6fd
files lisp/progmodes/sh-script.el
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/sh-script.el	Thu Jan 02 02:30:33 1997 +0000
+++ b/lisp/progmodes/sh-script.el	Thu Jan 02 02:51:05 1997 +0000
@@ -101,7 +101,15 @@
 shell it really is.")
 
 
-(defvar sh-shell-file (or (getenv "SHELL") "/bin/sh")
+(defvar sh-shell-file
+  (or
+   ;; On MSDOS, collapse $SHELL to lower-case and remove the
+   ;; executable extension, so comparisons with the list of
+   ;; known shells work.
+   (and (eq system-type 'ms-dos)
+	(file-name-sans-extension (downcase (getenv "SHELL"))))
+   (getenv "SHELL")
+   "/bin/sh")
   "*The executable file name for the shell being programmed.")
 
 
@@ -408,8 +416,8 @@
 	  "bye" "logout")
 
     ;; The next entry is only used for defining the others
-    (bourne eval sh-append shell
-	    "done" "esac" "fi" "for" "function" "in" "return")
+    (bourne eval sh-append sh
+	    "function")
 
     (csh eval sh-append shell
 	 "breaksw" "default" "end" "endif" "endsw" "foreach" "goto"
@@ -424,6 +432,9 @@
     (rc "break" "case" "exec" "exit" "fn" "for" "if" "in" "return" "switch"
 	"while")
 
+    (sh eval sh-append shell
+	"done" "esac" "fi" "for" "in" "return")
+
     ;; The next entry is only used for defining the others
     (shell "break" "case" "continue" "exec" "exit")
 
@@ -644,12 +655,9 @@
 	   (goto-char (point-min))
 	   (if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
 	       (buffer-substring (match-beginning 2)
-				 (match-end 2)))))
-	elt)
+				 (match-end 2))))))
     (if interpreter
-	(sh-set-shell interpreter nil
-		      (and (zerop (buffer-size))
-			   (not buffer-read-only)))))
+	(sh-set-shell interpreter nil nil)))
   (run-hooks 'sh-mode-hook))
 ;;;###autoload
 (defalias 'shell-script-mode 'sh-mode)