summaryrefslogtreecommitdiff
path: root/Auxiliary
diff options
context:
space:
mode:
authorRoy Crihfield <rscrihf@gmail.com>2015-03-06 16:34:37 -0500
committerBrad King <brad.king@kitware.com>2015-07-27 09:40:07 -0400
commit41d6044bcfed908a6197502b038bea86a5ad3526 (patch)
treeb981751801b2b7d8c699729107b6421968b8051c /Auxiliary
parent7987d9857e581b5266d98d79aa71a8f45611f203 (diff)
downloadcmake-41d6044bcfed908a6197502b038bea86a5ad3526.tar.gz
cmake-mode.el: Add font-lock for keywords and variables
Control flow keywords will now be highlighted as such. Variable names will be also be recognized. Adjust function name highlighting to work in places other than the start of a line.
Diffstat (limited to 'Auxiliary')
-rw-r--r--Auxiliary/cmake-mode.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index ea2415ddb0..6e1a23c5c1 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -193,9 +193,17 @@ the indentation. Otherwise it retains the same position on the line"
;; Keyword highlighting regex-to-face map.
;;
(defconst cmake-font-lock-keywords
- (list '("^[ \t]*\\([[:word:]_]+\\)[ \t]*(" 1 font-lock-function-name-face))
- "Highlighting expressions for CMAKE mode."
- )
+ `((,(rx-to-string `(and symbol-start
+ (or ,@cmake-keywords
+ ,@(mapcar #'downcase cmake-keywords))
+ symbol-end))
+ . font-lock-keyword-face)
+ (,(rx symbol-start (group (+ (or word (syntax symbol)))) ?\()
+ 1 font-lock-function-name-face)
+ ("\\${?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[$*_]\\)"
+ 1 font-lock-variable-name-face t)
+ )
+ "Highlighting expressions for CMake mode.")
;------------------------------------------------------------------------------