diff options
author | Fanael Linithien <fanael4@gmail.com> | 2014-11-22 17:35:46 (GMT) |
---|---|---|
committer | Fanael Linithien <fanael4@gmail.com> | 2014-11-23 21:25:27 (GMT) |
commit | 327c094596228b8dfdc3715a560ef226cd1403a9 (patch) | |
tree | 4418c8ed6eff2611e7075830e8ad465617675995 /misc | |
parent | c600a8258959e7338296423bc05cf47534272ae7 (diff) | |
download | Ninja-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.el | 13 |
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 |