From: Thien-Thi Nguyen Date: Sat, 25 Feb 2006 11:25:25 +0000 (+0000) Subject: (sh-mode): Fix bug: Arrange to use X-Git-Tag: emacs-pretest-22.0.90~3904 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=19cd88cc939313424c36dc78f4cdb3f293fc8cc9;p=emacs.git (sh-mode): Fix bug: Arrange to use the default shell if filename is not available. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd4d546377f..efab2f66d93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-02-25 Thien-Thi Nguyen + + * progmodes/sh-script.el (sh-mode): Fix bug: Arrange + to use the default shell if filename is not available. + Reported by Giorgos Keramidas. + 2006-02-25 John Williams (tiny change) * 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." (set (make-local-variable 'parse-sexp-ignore-comments) t) ;; Parse or insert magic number for exec, and set all variables depending ;; on the shell thus determined. - (let ((interpreter - (save-excursion - (goto-char (point-min)) - (cond ((looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") - (match-string 2)) - ((and buffer-file-name - (string-match "\\.m?spec\\'" buffer-file-name)) - "rpm"))))) - (unless interpreter - (setq interpreter - (cond ((string-match "[.]sh\\>" buffer-file-name) - "sh") - ((string-match "[.]bash\\>" buffer-file-name) - "bash") - ((string-match "[.]ksh\\>" buffer-file-name) - "ksh") - ((string-match "[.]csh\\>" buffer-file-name) - "csh")))) - (sh-set-shell (or interpreter sh-shell-file) nil nil)) + (sh-set-shell + (cond ((save-excursion + (goto-char (point-min)) + (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")) + (match-string 2)) + ((not buffer-file-name) + sh-shell-file) + ;; Checks that use `buffer-file-name' follow. + ((string-match "\\.m?spec\\'" buffer-file-name) + "rpm") + ((string-match "[.]sh\\>" buffer-file-name) + "sh") + ((string-match "[.]bash\\>" buffer-file-name) + "bash") + ((string-match "[.]ksh\\>" buffer-file-name) + "ksh") + ((string-match "[.]csh\\>" buffer-file-name) + "csh") + (t + sh-shell-file)) + nil nil) (run-mode-hooks 'sh-mode-hook)) ;;;###autoload