Mercurial > emacs
comparison lisp/progmodes/cfengine.el @ 72799:ff69721bef4a
(cfengine-font-lock-syntactic-keywords): New var.
(cfengine-mode): Use it. Fix \ syntax to be like /.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 11 Sep 2006 07:12:37 +0000 |
parents | dc49655f57ae |
children | 0e3ea59d0acd a1a25ac6c88a |
comparison
equal
deleted
inserted
replaced
72798:6e061fdbf037 | 72799:ff69721bef4a |
---|---|
82 ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face) | 82 ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face) |
83 ;; Variable definitions. | 83 ;; Variable definitions. |
84 ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) | 84 ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face) |
85 ;; File, acl &c in group: { token ... } | 85 ;; File, acl &c in group: { token ... } |
86 ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) | 86 ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face))) |
87 | |
88 (defconst cfengine-font-lock-syntactic-keywords | |
89 ;; In the main syntax-table, backslash is marked as a punctuation, because | |
90 ;; of its use in DOS-style directory separators. Here we try to recognize | |
91 ;; the cases where backslash is used as an escape inside strings. | |
92 '(("\\(\\(?:\\\\\\)+\\)\"" . "\\"))) | |
87 | 93 |
88 (defvar cfengine-imenu-expression | 94 (defvar cfengine-imenu-expression |
89 `((nil ,(concat "^[ \t]*" (eval-when-compile | 95 `((nil ,(concat "^[ \t]*" (eval-when-compile |
90 (regexp-opt cfengine-actions t)) | 96 (regexp-opt cfengine-actions t)) |
91 ":[^:]") | 97 ":[^:]") |
216 (modify-syntax-entry ?\' "\"" cfengine-mode-syntax-table) | 222 (modify-syntax-entry ?\' "\"" cfengine-mode-syntax-table) |
217 (modify-syntax-entry ?\` "\"" cfengine-mode-syntax-table) | 223 (modify-syntax-entry ?\` "\"" cfengine-mode-syntax-table) |
218 ;; variable substitution: | 224 ;; variable substitution: |
219 (modify-syntax-entry ?$ "." cfengine-mode-syntax-table) | 225 (modify-syntax-entry ?$ "." cfengine-mode-syntax-table) |
220 ;; Doze path separators: | 226 ;; Doze path separators: |
221 (modify-syntax-entry ?\\ "_" cfengine-mode-syntax-table) | 227 (modify-syntax-entry ?\\ "." cfengine-mode-syntax-table) |
222 ;; Otherwise, syntax defaults seem OK to give reasonable word | 228 ;; Otherwise, syntax defaults seem OK to give reasonable word |
223 ;; movement. | 229 ;; movement. |
224 | 230 |
225 (set (make-local-variable 'parens-require-spaces) nil) | 231 (set (make-local-variable 'parens-require-spaces) nil) |
226 (set (make-local-variable 'require-final-newline) mode-require-final-newline) | 232 (set (make-local-variable 'require-final-newline) mode-require-final-newline) |
235 (define-abbrev-table 'cfengine-mode-abbrev-table cfengine-mode-abbrevs) | 241 (define-abbrev-table 'cfengine-mode-abbrev-table cfengine-mode-abbrevs) |
236 ;; Fixme: Use `font-lock-syntactic-keywords' to set the args of | 242 ;; Fixme: Use `font-lock-syntactic-keywords' to set the args of |
237 ;; functions in evaluated classes to string syntax, and then obey | 243 ;; functions in evaluated classes to string syntax, and then obey |
238 ;; syntax properties. | 244 ;; syntax properties. |
239 (setq font-lock-defaults | 245 (setq font-lock-defaults |
240 '(cfengine-font-lock-keywords nil nil nil beginning-of-line)) | 246 '(cfengine-font-lock-keywords nil nil nil beginning-of-line |
247 (font-lock-syntactic-keywords | |
248 . cfengine-font-lock-syntactic-keywords))) | |
241 (setq imenu-generic-expression cfengine-imenu-expression) | 249 (setq imenu-generic-expression cfengine-imenu-expression) |
242 (set (make-local-variable 'beginning-of-defun-function) | 250 (set (make-local-variable 'beginning-of-defun-function) |
243 #'cfengine-beginning-of-defun) | 251 #'cfengine-beginning-of-defun) |
244 (set (make-local-variable 'end-of-defun-function) #'cfengine-end-of-defun) | 252 (set (make-local-variable 'end-of-defun-function) #'cfengine-end-of-defun) |
245 ;; Like Lisp mode. Without this, we lose with, say, | 253 ;; Like Lisp mode. Without this, we lose with, say, |
247 ;; preceding comment. | 255 ;; preceding comment. |
248 (set (make-local-variable 'parse-sexp-ignore-comments) t)) | 256 (set (make-local-variable 'parse-sexp-ignore-comments) t)) |
249 | 257 |
250 (provide 'cfengine) | 258 (provide 'cfengine) |
251 | 259 |
252 ;;; arch-tag: 6b931be2-1505-4124-afa6-9675971e26d4 | 260 ;; arch-tag: 6b931be2-1505-4124-afa6-9675971e26d4 |
253 ;;; cfengine.el ends here | 261 ;;; cfengine.el ends here |