diff options
| author | Richard M. Stallman | 1997-01-02 02:51:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-01-02 02:51:05 +0000 |
| commit | d9de8c0454a55f55e1e4c1b14a9cebbf6a868ef8 (patch) | |
| tree | 23df3f16ae14ac84b6038bc76f92f72e01d82a22 /lisp | |
| parent | 9317a902a2ad8ae248469e2e7e44c1613f5365d5 (diff) | |
| download | emacs-d9de8c0454a55f55e1e4c1b14a9cebbf6a868ef8.tar.gz emacs-d9de8c0454a55f55e1e4c1b14a9cebbf6a868ef8.zip | |
(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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/sh-script.el | 24 |
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 | |||
| 101 | shell it really is.") | 101 | shell it really is.") |
| 102 | 102 | ||
| 103 | 103 | ||
| 104 | (defvar sh-shell-file (or (getenv "SHELL") "/bin/sh") | 104 | (defvar sh-shell-file |
| 105 | (or | ||
| 106 | ;; On MSDOS, collapse $SHELL to lower-case and remove the | ||
| 107 | ;; executable extension, so comparisons with the list of | ||
| 108 | ;; known shells work. | ||
| 109 | (and (eq system-type 'ms-dos) | ||
| 110 | (file-name-sans-extension (downcase (getenv "SHELL")))) | ||
| 111 | (getenv "SHELL") | ||
| 112 | "/bin/sh") | ||
| 105 | "*The executable file name for the shell being programmed.") | 113 | "*The executable file name for the shell being programmed.") |
| 106 | 114 | ||
| 107 | 115 | ||
| @@ -408,8 +416,8 @@ flow of control or syntax. See `sh-feature'.") | |||
| 408 | "bye" "logout") | 416 | "bye" "logout") |
| 409 | 417 | ||
| 410 | ;; The next entry is only used for defining the others | 418 | ;; The next entry is only used for defining the others |
| 411 | (bourne eval sh-append shell | 419 | (bourne eval sh-append sh |
| 412 | "done" "esac" "fi" "for" "function" "in" "return") | 420 | "function") |
| 413 | 421 | ||
| 414 | (csh eval sh-append shell | 422 | (csh eval sh-append shell |
| 415 | "breaksw" "default" "end" "endif" "endsw" "foreach" "goto" | 423 | "breaksw" "default" "end" "endif" "endsw" "foreach" "goto" |
| @@ -424,6 +432,9 @@ flow of control or syntax. See `sh-feature'.") | |||
| 424 | (rc "break" "case" "exec" "exit" "fn" "for" "if" "in" "return" "switch" | 432 | (rc "break" "case" "exec" "exit" "fn" "for" "if" "in" "return" "switch" |
| 425 | "while") | 433 | "while") |
| 426 | 434 | ||
| 435 | (sh eval sh-append shell | ||
| 436 | "done" "esac" "fi" "for" "in" "return") | ||
| 437 | |||
| 427 | ;; The next entry is only used for defining the others | 438 | ;; The next entry is only used for defining the others |
| 428 | (shell "break" "case" "continue" "exec" "exit") | 439 | (shell "break" "case" "continue" "exec" "exit") |
| 429 | 440 | ||
| @@ -644,12 +655,9 @@ with your script for an edit-interpret-debug cycle." | |||
| 644 | (goto-char (point-min)) | 655 | (goto-char (point-min)) |
| 645 | (if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") | 656 | (if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") |
| 646 | (buffer-substring (match-beginning 2) | 657 | (buffer-substring (match-beginning 2) |
| 647 | (match-end 2))))) | 658 | (match-end 2)))))) |
| 648 | elt) | ||
| 649 | (if interpreter | 659 | (if interpreter |
| 650 | (sh-set-shell interpreter nil | 660 | (sh-set-shell interpreter nil nil))) |
| 651 | (and (zerop (buffer-size)) | ||
| 652 | (not buffer-read-only))))) | ||
| 653 | (run-hooks 'sh-mode-hook)) | 661 | (run-hooks 'sh-mode-hook)) |
| 654 | ;;;###autoload | 662 | ;;;###autoload |
| 655 | (defalias 'shell-script-mode 'sh-mode) | 663 | (defalias 'shell-script-mode 'sh-mode) |