sh-script: improve fontification of RPM spec files

Fontifiy only macros at line beginning as keywords, otherwise as
variables.  Add more accurate match for macros.

* lisp/progmodes/sh-script.el (sh-font-lock-keywords-var): Add
more accurate patterns for rpm macros.  Also fontify parenthesized
word after keyword.
This commit is contained in:
Andreas Schwab 2023-06-12 14:40:24 +02:00 committed by Andreas Schwab
parent 667348682b
commit a5bf0ae661

View file

@ -864,10 +864,13 @@ See `sh-feature'.")
("\\${?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[$*_]\\)" 1
font-lock-variable-name-face))
(rpm sh-append rpm2
("%{?\\(\\sw+\\)" 1 font-lock-keyword-face))
("^\\s-*%\\(\\sw+\\)" 1 font-lock-keyword-face)
("%{?\\([!?]*[[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[%*#]\\*?\\|!?-[[:alpha:]]\\*?\\)"
1 font-lock-variable-name-face))
(rpm2 sh-append shell
("^Summary:\\(.*\\)$" (1 font-lock-doc-face t))
("^\\(\\sw+\\):" 1 font-lock-variable-name-face)))
("^\\(\\sw+\\)\\((\\(\\sw+\\))\\)?:" (1 font-lock-variable-name-face)
(3 font-lock-string-face nil t))))
"Default expressions to highlight in Shell Script modes. See `sh-feature'.")
(defvar sh-font-lock-keywords-var-1