changeset 8106:ec8291e58762

(sh-set-shell): Obey sh-query-for-magic in all cases. (sh-mode): Don't move point permanently.
author Richard M. Stallman <rms@gnu.org>
date Fri, 01 Jul 1994 16:28:00 +0000
parents e1958b89aa88
children 0885b28decc6
files lisp/progmodes/sh-script.el
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/sh-script.el	Fri Jul 01 15:36:06 1994 +0000
+++ b/lisp/progmodes/sh-script.el	Fri Jul 01 16:28:00 1994 +0000
@@ -402,12 +402,13 @@
 	font-lock-keywords-case-fold-search nil
 	pair-alist '((?` _ ?`))
 	pair-filter 'sh-quoted-p)
-  ; parse or insert magic number for exec()
-  (goto-char (point-min))
-  (sh-set-shell
-   (if (looking-at "#![\t ]*\\([^\t\n ]+\\)")
-       (buffer-substring (match-beginning 1) (match-end 1))
-     sh-shell-path))
+  ;; parse or insert magic number for exec
+  (save-excursion
+    (goto-char (point-min))
+    (sh-set-shell
+     (if (looking-at "#![\t ]*\\([^\t\n ]+\\)")
+	 (buffer-substring (match-beginning 1) (match-end 1))
+       sh-shell-path)))
   ;; find-file is set by `normal-mode' when called by `after-find-file'
   (and (boundp 'find-file) find-file
        (or (eq sh-find-file-modifies t)
@@ -852,7 +853,10 @@
 			     (buffer-substring (point-min) (point))))
 		  (not (delete-region (point) (progn (end-of-line) (point))))
 		  (insert shell))
-	   (insert "#! " shell ?\n))))
+	   (if (if sh-query-for-magic
+		   (y-or-n-p (concat "Add ``#! " shell "''? "))
+		 t)
+	       (insert "#! " shell ?\n)))))
   (run-hooks 'sh-set-shell-hook))