diff options
| author | Thien-Thi Nguyen | 2006-02-25 11:25:25 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2006-02-25 11:25:25 +0000 |
| commit | 19cd88cc939313424c36dc78f4cdb3f293fc8cc9 (patch) | |
| tree | c0394571df833c50bff265d62e86110f18f3eaa9 | |
| parent | f37de644fdbf7b2b200ae4ca4af3b1496e7b0265 (diff) | |
| download | emacs-19cd88cc939313424c36dc78f4cdb3f293fc8cc9.tar.gz emacs-19cd88cc939313424c36dc78f4cdb3f293fc8cc9.zip | |
(sh-mode): Fix bug: Arrange to use
the default shell if filename is not available.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 40 |
2 files changed, 27 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd4d546377f..efab2f66d93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2006-02-25 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/sh-script.el (sh-mode): Fix bug: Arrange | ||
| 4 | to use the default shell if filename is not available. | ||
| 5 | Reported by Giorgos Keramidas. | ||
| 6 | |||
| 1 | 2006-02-25 John Williams <jrw@pobox.com> (tiny change) | 7 | 2006-02-25 John Williams <jrw@pobox.com> (tiny change) |
| 2 | 8 | ||
| 3 | * progmodes/etags.el (tags-completion-table): Do completion from | 9 | * progmodes/etags.el (tags-completion-table): Do completion from |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 02ce4a21c97..06ae4de7669 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -1430,25 +1430,27 @@ with your script for an edit-interpret-debug cycle." | |||
| 1430 | (set (make-local-variable 'parse-sexp-ignore-comments) t) | 1430 | (set (make-local-variable 'parse-sexp-ignore-comments) t) |
| 1431 | ;; Parse or insert magic number for exec, and set all variables depending | 1431 | ;; Parse or insert magic number for exec, and set all variables depending |
| 1432 | ;; on the shell thus determined. | 1432 | ;; on the shell thus determined. |
| 1433 | (let ((interpreter | 1433 | (sh-set-shell |
| 1434 | (save-excursion | 1434 | (cond ((save-excursion |
| 1435 | (goto-char (point-min)) | 1435 | (goto-char (point-min)) |
| 1436 | (cond ((looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") | 1436 | (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")) |
| 1437 | (match-string 2)) | 1437 | (match-string 2)) |
| 1438 | ((and buffer-file-name | 1438 | ((not buffer-file-name) |
| 1439 | (string-match "\\.m?spec\\'" buffer-file-name)) | 1439 | sh-shell-file) |
| 1440 | "rpm"))))) | 1440 | ;; Checks that use `buffer-file-name' follow. |
| 1441 | (unless interpreter | 1441 | ((string-match "\\.m?spec\\'" buffer-file-name) |
| 1442 | (setq interpreter | 1442 | "rpm") |
| 1443 | (cond ((string-match "[.]sh\\>" buffer-file-name) | 1443 | ((string-match "[.]sh\\>" buffer-file-name) |
| 1444 | "sh") | 1444 | "sh") |
| 1445 | ((string-match "[.]bash\\>" buffer-file-name) | 1445 | ((string-match "[.]bash\\>" buffer-file-name) |
| 1446 | "bash") | 1446 | "bash") |
| 1447 | ((string-match "[.]ksh\\>" buffer-file-name) | 1447 | ((string-match "[.]ksh\\>" buffer-file-name) |
| 1448 | "ksh") | 1448 | "ksh") |
| 1449 | ((string-match "[.]csh\\>" buffer-file-name) | 1449 | ((string-match "[.]csh\\>" buffer-file-name) |
| 1450 | "csh")))) | 1450 | "csh") |
| 1451 | (sh-set-shell (or interpreter sh-shell-file) nil nil)) | 1451 | (t |
| 1452 | sh-shell-file)) | ||
| 1453 | nil nil) | ||
| 1452 | (run-mode-hooks 'sh-mode-hook)) | 1454 | (run-mode-hooks 'sh-mode-hook)) |
| 1453 | 1455 | ||
| 1454 | ;;;###autoload | 1456 | ;;;###autoload |