emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a5bf0ae6614: sh-script: improve fontification of RPM spec files


From: Andreas Schwab
Subject: master a5bf0ae6614: sh-script: improve fontification of RPM spec files
Date: Sun, 2 Jul 2023 18:09:07 -0400 (EDT)

branch: master
commit a5bf0ae66141e7560f70a045c0dea132a4868c87
Author: Andreas Schwab <schwab@suse.de>
Commit: Andreas Schwab <schwab@linux-m68k.org>

    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.
---
 lisp/progmodes/sh-script.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index a305c35c5f8..cfc10878922 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]