From 1448f5894e3bcd114b20604165dd42d97f1bd37f Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Sat, 15 May 1999 05:57:39 +0000 Subject: [PATCH] (sh-mode): Do not fail if buffer has no magic number and is not associated with a file. --- lisp/progmodes/sh-script.el | 5 +++-- 1 file 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) -- 2.39.2