]> git.eshelyaron.com Git - emacs.git/commitdiff
(sh-mode): Fix bug: Arrange to use
authorThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 25 Feb 2006 11:25:25 +0000 (11:25 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 25 Feb 2006 11:25:25 +0000 (11:25 +0000)
the default shell if filename is not available.

lisp/ChangeLog
lisp/progmodes/sh-script.el

index dd4d546377f45e39579f26de4c1dde636c68eb0e..efab2f66d93b9ca7c0d03e35751cd956c2de04b9 100644 (file)
@@ -1,3 +1,9 @@
+2006-02-25  Thien-Thi Nguyen  <ttn@gnu.org>
+
+       * 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  <jrw@pobox.com>  (tiny change)
 
        * progmodes/etags.el (tags-completion-table): Do completion from
index 02ce4a21c97abf162b6d03b83568accec6e02d6a..06ae4de766990bccb12417c6838b10d36796340d 100644 (file)
@@ -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