comparison lisp/progmodes/sh-script.el @ 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 380e8fcde9a2
children cf243e9e63f8
comparison
equal deleted inserted replaced
8105:e1958b89aa88 8106:ec8291e58762
400 ;; C shells do 400 ;; C shells do
401 require-final-newline t 401 require-final-newline t
402 font-lock-keywords-case-fold-search nil 402 font-lock-keywords-case-fold-search nil
403 pair-alist '((?` _ ?`)) 403 pair-alist '((?` _ ?`))
404 pair-filter 'sh-quoted-p) 404 pair-filter 'sh-quoted-p)
405 ; parse or insert magic number for exec() 405 ;; parse or insert magic number for exec
406 (goto-char (point-min)) 406 (save-excursion
407 (sh-set-shell 407 (goto-char (point-min))
408 (if (looking-at "#![\t ]*\\([^\t\n ]+\\)") 408 (sh-set-shell
409 (buffer-substring (match-beginning 1) (match-end 1)) 409 (if (looking-at "#![\t ]*\\([^\t\n ]+\\)")
410 sh-shell-path)) 410 (buffer-substring (match-beginning 1) (match-end 1))
411 sh-shell-path)))
411 ;; find-file is set by `normal-mode' when called by `after-find-file' 412 ;; find-file is set by `normal-mode' when called by `after-find-file'
412 (and (boundp 'find-file) find-file 413 (and (boundp 'find-file) find-file
413 (or (eq sh-find-file-modifies t) 414 (or (eq sh-find-file-modifies t)
414 (set-buffer-modified-p nil))) 415 (set-buffer-modified-p nil)))
415 (run-hooks 'sh-mode-hook)) 416 (run-hooks 'sh-mode-hook))
850 shell "''? ")) 851 shell "''? "))
851 (message "Magic number ``%s'' replaced." 852 (message "Magic number ``%s'' replaced."
852 (buffer-substring (point-min) (point)))) 853 (buffer-substring (point-min) (point))))
853 (not (delete-region (point) (progn (end-of-line) (point)))) 854 (not (delete-region (point) (progn (end-of-line) (point))))
854 (insert shell)) 855 (insert shell))
855 (insert "#! " shell ?\n)))) 856 (if (if sh-query-for-magic
857 (y-or-n-p (concat "Add ``#! " shell "''? "))
858 t)
859 (insert "#! " shell ?\n)))))
856 (run-hooks 'sh-set-shell-hook)) 860 (run-hooks 'sh-set-shell-hook))
857 861
858 862
859 863
860 (defun sh-beginning-of-command () 864 (defun sh-beginning-of-command ()