[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/systemd 4c0ec1e 105/131: split font-lock-keywords into lev
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/systemd 4c0ec1e 105/131: split font-lock-keywords into levels |
Date: |
Sun, 29 Aug 2021 11:35:23 -0400 (EDT) |
branch: elpa/systemd
commit 4c0ec1e599690ba8a3f65d0d916813af5342122f
Author: Mark Oteiza <mvoteiza@udel.edu>
Commit: Mark Oteiza <mvoteiza@udel.edu>
split font-lock-keywords into levels
more importantly, bind systemd-font-lock-keywords to a _symbol_.
this makes hacking font-lock-keywords on the fly a little easier, in
addition to adding to customization/granularity
(info "(elisp) Font Lock Basics")
---
systemd.el | 51 ++++++++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/systemd.el b/systemd.el
index 79d423f..42410b9 100644
--- a/systemd.el
+++ b/systemd.el
@@ -258,26 +258,32 @@ See `font-lock-keywords' and (info \"(elisp) Search-based
Fontification\")."
(`candidates (all-completions arg (systemd-completion-table nil)))
(`post-completion (if (not (systemd-buffer-section-p)) (insert "=")))))
-(defvar systemd-font-lock-keywords
- (eval-when-compile
- `(("^[[:space:]]*?\\([#;]\\)\\(.*\\)$"
- (1 'font-lock-comment-delimiter-face)
- (2 'font-lock-comment-face))
- ("\\\\$" 0 'font-lock-warning-face) ; line break
- ;; sections
- ("^\\(\\[\\([[:upper:]][[:alnum:]]+\\|X-.*?\\)\\]\\)"
- 1 'font-lock-type-face)
- ;; keys
- ("^\\([[:upper:]][[:alnum:]]+\\)=" 1 'font-lock-keyword-face)
- ;; boolean arguments
- (,(rx "=" (group (or "yes" "true" "on" "0" "no" "false" "off")) eol)
- 1 'font-lock-constant-face)
- ;; specifiers
- ("%[nNpPiIfcrRtuUhsmbHv%]" 0 'font-lock-constant-face)
- ;; exec prefixes
- ("="
- (systemd-exec-prefix-anchored-matcher
- nil nil (0 'font-lock-negation-char-face)))))
+(defconst systemd-font-lock-keywords-1
+ `(("^[[:space:]]*?\\([#;]\\)\\(.*\\)$"
+ (1 'font-lock-comment-delimiter-face)
+ (2 'font-lock-comment-face))
+ ;; sections
+ ("^\\(\\[\\([[:upper:]][[:alnum:]]+\\|X-.*?\\)\\]\\)"
+ 1 'font-lock-type-face)
+ ;; keys
+ ("^\\([[:upper:]][[:alnum:]]+\\)=" 1 'font-lock-keyword-face))
+ "Minimal expressions to highlight in `systemd-mode'.")
+
+(defconst systemd-font-lock-keywords-2
+ `(,@systemd-font-lock-keywords-1
+ ("\\\\$" 0 'font-lock-warning-face) ; line break
+ ;; boolean arguments
+ (,(rx "=" (group (or "yes" "true" "on" "0" "no" "false" "off")) eol)
+ 1 'font-lock-constant-face)
+ ;; specifiers
+ ("%[nNpPiIfcrRtuUhsmbHv%]" 0 'font-lock-constant-face)
+ ;; exec prefixes
+ ("="
+ (systemd-exec-prefix-anchored-matcher
+ nil nil (0 'font-lock-negation-char-face))))
+ "Extended expressions to highlight in `systemd-mode'.")
+
+(defvar systemd-font-lock-keywords 'systemd-font-lock-keywords-2
"Default expressions to highlight in `systemd-mode'.
See systemd.unit(5) for details on unit file syntax.")
@@ -322,7 +328,10 @@ Key bindings:
(conf-mode-initialize systemd-comment-start)
(add-hook 'company-backends #'systemd-company-backend)
(add-hook 'completion-at-point-functions #'systemd-complete-at-point nil t)
- (setq font-lock-defaults '(systemd-font-lock-keywords t)))
+ (setq font-lock-defaults
+ '((systemd-font-lock-keywords
+ systemd-font-lock-keywords-1 systemd-font-lock-keywords-2)
+ t)))
(provide 'systemd)
- [nongnu] elpa/systemd 9cfd315 102/131: simplify, (continued)
- [nongnu] elpa/systemd 9cfd315 102/131: simplify, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 1e7567a 117/131: prepare v1.6, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 077aedd 125/131: systemd 244 directives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 53b44ad 001/131: initial commit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 7bdb35a 032/131: mention package archive in README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 3cb77a5 013/131: add a link, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd a46e81b 017/131: autoload for slice units, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd b03e616 079/131: bump, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd a1633c2 083/131: systemd 231 directives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 7769000 086/131: bump to 0.4.1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 4c0ec1e 105/131: split font-lock-keywords into levels,
ELPA Syncer <=
- [nongnu] elpa/systemd 9265ef8 126/131: update section lists, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 6b0878e 016/131: add autoload for drop-ins with `systemctl edit`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 7ef42d5 020/131: adopt browse url function from lua-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd c8d3472 012/131: add commentary, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd ac11adf 025/131: add tunable for using either `man` or `woman`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd d7a9c1d 045/131: fontify "-" and "@" prefixes, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd d03b70c 043/131: derive from conf-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 6f2e31e 048/131: add a mode menu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 1a7af12 051/131: no strings with single quotes either, ELPA Syncer, 2021/08/29
- [nongnu] elpa/systemd 26de1dd 056/131: don't turn on company by default, ELPA Syncer, 2021/08/29