From cc466ddbee70cee641235e26348343d131c40201 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 27 Jun 2017 15:52:54 +0200 Subject: [PATCH] fix font-lock --- config-general-mode.el | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/config-general-mode.el b/config-general-mode.el index 7c59a20..664dcb9 100644 --- a/config-general-mode.el +++ b/config-general-mode.el @@ -173,6 +173,11 @@ "face for escape chars" :group 'config-general-faces) +(defface config-general-string-face + '((t (:inherit font-lock-string-face))) + "face for strings" + :group 'config-general-faces) + ;;;; Global Vars (defconst config-general-mode-version "0.01" "Config::General mode version") @@ -394,7 +399,7 @@ string). It returns t if a new expansion is found, nil otherwise." st))) (defun config-general--init-font-lock () - ;; better suited to configs + ;; better suited to configs (setq config-general-font-lock-keywords '( ;; <> @@ -404,7 +409,14 @@ string). It returns t if a new expansion is found, nil otherwise." (config-general-match-variables-in-quotes (1 'default t) (2 font-lock-variable-name-face t)) - + + ;; EOF + ("\\(<<\\)\\([A-Z0-9]+\\)$" + (1 'config-general-escape-char-face) + (2 'config-general-constant-face)) + ("^[ \t]*\\([A-Z0-9]+?\\)$" + (1 'config-general-constant-face)) + ;; <> ("^[ \t]*<<\\(include\\) [ \t]*\\(.+?\\)>>*" (1 'config-general-constant-face) @@ -430,15 +442,10 @@ string). It returns t if a new expansion is found, nil otherwise." ;; escape char ("\\(\\\\\\)" (1 'config-general-escape-char-face)) - )) - (set (make-local-variable 'font-lock-defaults) - '(config-general-font-lock-keywords nil t nil nil)) - - (font-lock-add-keywords nil - '((config-general--fl-beg-eof . 'config-general-constant-face) - (config-general--fl-end-eof . 'config-general-constant-face)))) + '(config-general-font-lock-keywords nil nil nil nil)) + (font-lock-mode 1)) (defun config-general--init-minors () ;; from shell-script-mode, turn << into here-doc