summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1999-05-15 05:57:39 +0000
committerKarl Heuer <kwzh@gnu.org>1999-05-15 05:57:39 +0000
commit1448f5894e3bcd114b20604165dd42d97f1bd37f (patch)
treecf5e081afd7e396872122fc129ebc54671cc38ba /lisp
parenta62a0574d4d935048022a6e0a9856c1fecf07dea (diff)
downloademacs-1448f5894e3bcd114b20604165dd42d97f1bd37f.tar.gz
emacs-1448f5894e3bcd114b20604165dd42d97f1bd37f.tar.bz2
emacs-1448f5894e3bcd114b20604165dd42d97f1bd37f.zip
(sh-mode): Do not fail if buffer has no
magic number and is not associated with a file.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/sh-script.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 22dae00d40c..44d70931f66 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -774,8 +774,9 @@ with your script for an edit-interpret-debug cycle."
(save-excursion
(goto-char (point-min))
(cond ((looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
- (match-string 2))
- ((string-match "\\.m?spec$" buffer-file-name)
+ (match-string 2))
+ ((and buffer-file-name
+ (string-match "\\.m?spec$" buffer-file-name))
"rpm")))))
(if interpreter
(sh-set-shell interpreter nil nil)