Mercurial > emacs
comparison lisp/progmodes/sh-script.el @ 23501:f12ae4499ae0
(sh-mode): Handle .spec and .mspec files.
(sh-font-lock-keywords): Handle rpm and rpm2.
(sh-ancestor-alist): Handle rpm.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 20 Oct 1998 18:50:13 +0000 |
parents | d29b6b51866f |
children | 8b4cdcbaf071 |
comparison
equal
deleted
inserted
replaced
23500:8f220d8d170d | 23501:f12ae4499ae0 |
---|---|
78 (pdksh . ksh88) | 78 (pdksh . ksh88) |
79 (posix . sh) | 79 (posix . sh) |
80 (tcsh . csh) | 80 (tcsh . csh) |
81 (wksh . ksh88) | 81 (wksh . ksh88) |
82 (wsh . sh) | 82 (wsh . sh) |
83 (zsh . ksh88)) | 83 (zsh . ksh88) |
84 (rpm . sh)) | |
84 "*Alist showing the direct ancestor of various shells. | 85 "*Alist showing the direct ancestor of various shells. |
85 This is the basis for `sh-feature'. See also `sh-alias-alist'. | 86 This is the basis for `sh-feature'. See also `sh-alias-alist'. |
86 By default we have the following three hierarchies: | 87 By default we have the following three hierarchies: |
87 | 88 |
88 csh C Shell | 89 csh C Shell |
632 | 633 |
633 ;; The next entry is only used for defining the others | 634 ;; The next entry is only used for defining the others |
634 (shell eval sh-append executable-font-lock-keywords | 635 (shell eval sh-append executable-font-lock-keywords |
635 '("\\\\[^A-Za-z0-9]" 0 font-lock-string-face) | 636 '("\\\\[^A-Za-z0-9]" 0 font-lock-string-face) |
636 '("\\${?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\|[$*_]\\)" 1 | 637 '("\\${?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\|[$*_]\\)" 1 |
637 font-lock-variable-name-face))) | 638 font-lock-variable-name-face)) |
639 (rpm eval sh-append rpm2 | |
640 '("%{?\\(\\sw+\\)" 1 font-lock-keyword-face)) | |
641 (rpm2 eval sh-append shell | |
642 '("^\\(\\sw+\\):" 1 font-lock-variable-name-face))) | |
638 "Default expressions to highlight in Shell Script modes. See `sh-feature'.") | 643 "Default expressions to highlight in Shell Script modes. See `sh-feature'.") |
639 | 644 |
640 (defvar sh-font-lock-keywords-1 | 645 (defvar sh-font-lock-keywords-1 |
641 '((sh "[ \t]in\\>")) | 646 '((sh "[ \t]in\\>")) |
642 "Subdued level highlighting for Shell Script modes.") | 647 "Subdued level highlighting for Shell Script modes.") |
766 ;; Parse or insert magic number for exec, and set all variables depending | 771 ;; Parse or insert magic number for exec, and set all variables depending |
767 ;; on the shell thus determined. | 772 ;; on the shell thus determined. |
768 (let ((interpreter | 773 (let ((interpreter |
769 (save-excursion | 774 (save-excursion |
770 (goto-char (point-min)) | 775 (goto-char (point-min)) |
771 (if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") | 776 (cond ((looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") |
772 (match-string 2))))) | 777 (match-string 2)) |
778 ((string-match "\\.m?spec$" buffer-file-name) | |
779 "rpm"))))) | |
773 (if interpreter | 780 (if interpreter |
774 (sh-set-shell interpreter nil nil) | 781 (sh-set-shell interpreter nil nil) |
775 (progn | 782 (progn |
776 ;; If we don't know the shell for this file, set the syntax | 783 ;; If we don't know the shell for this file, set the syntax |
777 ;; table anyway, for the user's normal choice of shell. | 784 ;; table anyway, for the user's normal choice of shell. |