# HG changeset patch # User Richard M. Stallman # Date 852173465 0 # Node ID 20dc495230a08acec3c8214e1df9d0a048173a2e # Parent c378600f005d038626480d6b7f4f09aecf75fd90 (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. diff -r c378600f005d -r 20dc495230a0 lisp/progmodes/sh-script.el --- 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)