diff options
| author | Richard M. Stallman | 1996-01-11 17:11:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-01-11 17:11:39 +0000 |
| commit | 616db04b185f9e52faa2e0c3f491fb4b7b22cd41 (patch) | |
| tree | ee7683bab36994b6768eab8e68cd61e7b3563cc0 | |
| parent | cdb4948056e0715e688e09378fed48888f6e36b8 (diff) | |
| download | emacs-616db04b185f9e52faa2e0c3f491fb4b7b22cd41.tar.gz emacs-616db04b185f9e52faa2e0c3f491fb4b7b22cd41.zip | |
(sh-mode): Don't move point.
(sh-set-shell): New args NO-QUERY-FLAG and INSERT-FLAG.
Pass them to executable-set-magic.
Really set font-lock-syntax-table. Slight cleanups.
| -rw-r--r-- | lisp/progmodes/sh-script.el | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a08ec44ac4b..c31a36ecd59 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -639,13 +639,14 @@ with your script for an edit-interpret-debug cycle." | |||
| 639 | (current-column))))) | 639 | (current-column))))) |
| 640 | skeleton-filter 'sh-feature | 640 | skeleton-filter 'sh-feature |
| 641 | skeleton-newline-indent-rigidly t) | 641 | skeleton-newline-indent-rigidly t) |
| 642 | ;; parse or insert magic number for exec() and set all variables depending | 642 | (save-excursion |
| 643 | ;; on the shell thus determined | 643 | ;; parse or insert magic number for exec() and set all variables depending |
| 644 | (goto-char (point-min)) | 644 | ;; on the shell thus determined |
| 645 | (sh-set-shell | 645 | (goto-char (point-min)) |
| 646 | (if (looking-at "#![\t ]*\\([^\t\n ]+\\)") | 646 | (sh-set-shell |
| 647 | (match-string 1) | 647 | (if (looking-at "#![\t ]*\\([^\t\n ]+\\)") |
| 648 | sh-shell-file)) | 648 | (match-string 1) |
| 649 | sh-shell-file))) | ||
| 649 | (run-hooks 'sh-mode-hook)) | 650 | (run-hooks 'sh-mode-hook)) |
| 650 | ;;;###autoload | 651 | ;;;###autoload |
| 651 | (defalias 'shell-script-mode 'sh-mode) | 652 | (defalias 'shell-script-mode 'sh-mode) |
| @@ -692,29 +693,28 @@ This adds rules for comments and assignments." | |||
| 692 | (sh-font-lock-keywords-1 t)) | 693 | (sh-font-lock-keywords-1 t)) |
| 693 | 694 | ||
| 694 | 695 | ||
| 695 | (defun sh-set-shell (shell) | 696 | (defun sh-set-shell (shell &optional no-query-flag insert-flag) |
| 696 | "Set this buffer's shell to SHELL (a string). | 697 | "Set this buffer's shell to SHELL (a string). |
| 697 | Makes this script executable via `executable-set-magic'. | 698 | Makes this script executable via `executable-set-magic'. |
| 698 | Calls the value of `sh-set-shell-hook' if set." | 699 | Calls the value of `sh-set-shell-hook' if set." |
| 699 | (interactive (list (completing-read "Name or path of shell: " | 700 | (interactive (list (completing-read "Name or path of shell: " |
| 700 | interpreter-mode-alist | 701 | interpreter-mode-alist |
| 701 | (lambda (x) (eq (cdr x) 'sh-mode))))) | 702 | (lambda (x) (eq (cdr x) 'sh-mode))) |
| 702 | (if (eq this-command 'sh-set-shell) | 703 | (eq executable-query 'function) |
| 703 | ;; prevent querying | 704 | t)) |
| 704 | (setq this-command 'executable-set-magic)) | ||
| 705 | (setq sh-shell (intern (file-name-nondirectory shell)) | 705 | (setq sh-shell (intern (file-name-nondirectory shell)) |
| 706 | sh-shell (or (cdr (assq sh-shell sh-alias-alist)) | 706 | sh-shell (or (cdr (assq sh-shell sh-alias-alist)) |
| 707 | sh-shell) | 707 | sh-shell)) |
| 708 | sh-shell-file (executable-set-magic shell (sh-feature sh-shell-arg)) | 708 | (setq sh-shell-file (executable-set-magic shell (sh-feature sh-shell-arg))) |
| 709 | (setq require-final-newline (sh-feature sh-require-final-newline) | ||
| 709 | ;;; local-abbrev-table (sh-feature sh-abbrevs) | 710 | ;;; local-abbrev-table (sh-feature sh-abbrevs) |
| 710 | require-final-newline (sh-feature sh-require-final-newline) | ||
| 711 | font-lock-keywords nil ; force resetting | 711 | font-lock-keywords nil ; force resetting |
| 712 | font-lock-syntax-table nil | ||
| 712 | comment-start-skip (concat (sh-feature sh-comment-prefix) "#+[\t ]*") | 713 | comment-start-skip (concat (sh-feature sh-comment-prefix) "#+[\t ]*") |
| 713 | mode-line-process (format "[%s]" sh-shell) | 714 | mode-line-process (format "[%s]" sh-shell) |
| 714 | process-environment (default-value 'process-environment) | 715 | process-environment (default-value 'process-environment) |
| 715 | shell (sh-feature sh-variables)) | 716 | shell (sh-feature sh-variables)) |
| 716 | (set-syntax-table (sh-feature sh-mode-syntax-table)) | 717 | (set-syntax-table (sh-feature sh-mode-syntax-table)) |
| 717 | (setq font-lock-syntax-table) | ||
| 718 | (save-excursion | 718 | (save-excursion |
| 719 | (while (search-forward "=" nil t) | 719 | (while (search-forward "=" nil t) |
| 720 | (sh-assignment 0))) | 720 | (sh-assignment 0))) |