fix font-lock

This commit is contained in:
Thomas von Dein
2017-06-27 15:52:54 +02:00
parent 25eb99b53c
commit cc466ddbee

View File

@@ -173,6 +173,11 @@
"face for escape chars" "face for escape chars"
:group 'config-general-faces) :group 'config-general-faces)
(defface config-general-string-face
'((t (:inherit font-lock-string-face)))
"face for strings"
:group 'config-general-faces)
;;;; Global Vars ;;;; Global Vars
(defconst config-general-mode-version "0.01" "Config::General mode version") (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))) st)))
(defun config-general--init-font-lock () (defun config-general--init-font-lock ()
;; better suited to configs ;; better suited to configs
(setq config-general-font-lock-keywords (setq config-general-font-lock-keywords
'( '(
;; <> ;; <>
@@ -405,6 +410,13 @@ string). It returns t if a new expansion is found, nil otherwise."
(1 'default t) (1 'default t)
(2 font-lock-variable-name-face 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))
;; <<include ...>> ;; <<include ...>>
("^[ \t]*<<\\(include\\) [ \t]*\\(.+?\\)>>*" ("^[ \t]*<<\\(include\\) [ \t]*\\(.+?\\)>>*"
(1 'config-general-constant-face) (1 'config-general-constant-face)
@@ -430,15 +442,10 @@ string). It returns t if a new expansion is found, nil otherwise."
;; escape char ;; escape char
("\\(\\\\\\)" (1 'config-general-escape-char-face)) ("\\(\\\\\\)" (1 'config-general-escape-char-face))
)) ))
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(config-general-font-lock-keywords nil t nil nil)) '(config-general-font-lock-keywords nil nil nil nil))
(font-lock-mode 1))
(font-lock-add-keywords nil
'((config-general--fl-beg-eof . 'config-general-constant-face)
(config-general--fl-end-eof . 'config-general-constant-face))))
(defun config-general--init-minors () (defun config-general--init-minors ()
;; from shell-script-mode, turn << into here-doc ;; from shell-script-mode, turn << into here-doc