summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-01-02 02:51:05 +0000
committerRichard M. Stallman <rms@gnu.org>1997-01-02 02:51:05 +0000
commit4a86d65a8b2d5080ab58c301fee328b825e3cbce (patch)
tree2b79ee6e85b8200f2167e6fa4faf9e6af9b8b2d7
parentaa6bee8cf8c54508e1dbd3aa3aac93cd9ba8827b (diff)
downloademacs-4a86d65a8b2d5080ab58c301fee328b825e3cbce.tar.gz
(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.
-rw-r--r--lisp/progmodes/sh-script.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 4c439e7e791..299b4527016 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -101,7 +101,15 @@ Use this where the name of the executable doesn't correspond to the type of
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 @@ flow of control or syntax. See `sh-feature'.")
"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 @@ flow of control or syntax. See `sh-feature'.")
(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 @@ with your script for an edit-interpret-debug cycle."
(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)