summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorFanael Linithien <fanael4@gmail.com>2014-11-22 17:35:46 (GMT)
committerFanael Linithien <fanael4@gmail.com>2014-11-23 21:25:27 (GMT)
commit327c094596228b8dfdc3715a560ef226cd1403a9 (patch)
tree4418c8ed6eff2611e7075830e8ad465617675995 /misc
parentc600a8258959e7338296423bc05cf47534272ae7 (diff)
downloadNinja-327c094596228b8dfdc3715a560ef226cd1403a9.zip
Ninja-327c094596228b8dfdc3715a560ef226cd1403a9.tar.gz
Ninja-327c094596228b8dfdc3715a560ef226cd1403a9.tar.bz2
Set up a proper syntax table for ninja-mode.
Since quotes are not meant to be treated as string delimiters, the syntax table is the place to tell Emacs so. This also means syntactic fontification can be reenabled and the font-lock keyword entry for comments removed.
Diffstat (limited to 'misc')
-rw-r--r--misc/ninja-mode.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/misc/ninja-mode.el b/misc/ninja-mode.el
index 10cec3e..021ede1 100644
--- a/misc/ninja-mode.el
+++ b/misc/ninja-mode.el
@@ -22,8 +22,7 @@
;;; Code:
(defvar ninja-keywords
- `(("^#.*" . font-lock-comment-face)
- (,(concat "^" (regexp-opt '("rule" "build" "subninja" "include"
+ `((,(concat "^" (regexp-opt '("rule" "build" "subninja" "include"
"pool" "default")
'words))
. font-lock-keyword-face)
@@ -38,12 +37,16 @@
("build +\\(?:[^:$\n]\\|$[:$]\\)+ *: *\\([[:alnum:]_.-]+\\)" .
(1 font-lock-function-name-face))))
+(defvar ninja-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?\" "." table)
+ table)
+ "Syntax table used in `ninja-mode'.")
+
;;;###autoload
(define-derived-mode ninja-mode prog-mode "ninja"
(set (make-local-variable 'comment-start) "#")
- ;; Pass extra "t" to turn off syntax-based fontification -- we don't want
- ;; quoted strings highlighted.
- (setq font-lock-defaults '(ninja-keywords t)))
+ (setq font-lock-defaults '(ninja-keywords)))
;; Run ninja-mode for files ending in .ninja.
;;;###autoload