aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl-mode.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl-mode.el b/vcl-mode.el
index c6ea5e1..97f66b1 100644
--- a/vcl-mode.el
+++ b/vcl-mode.el
@@ -57,26 +57,25 @@
57 (modify-syntax-entry ?| "." st) 57 (modify-syntax-entry ?| "." st)
58 (modify-syntax-entry ?_ "_" st) 58 (modify-syntax-entry ?_ "_" st)
59 (modify-syntax-entry ?\' "." st) 59 (modify-syntax-entry ?\' "." st)
60 (modify-syntax-entry ?\" "." st) 60 (modify-syntax-entry ?\" "." st)
61 (modify-syntax-entry ?{ "." st) 61 (modify-syntax-entry ?{ "." st)
62 (modify-syntax-entry ?} "." st) 62 (modify-syntax-entry ?} "." st)
63 st) 63 st)
64 "Syntax table in use in VCL Mode buffers.") 64 "Syntax table in use in VCL Mode buffers.")
65 65
66(defvar vcl-mode-abbrev-table nil 66(defvar vcl-mode-abbrev-table nil
67 "Abbreviation table used in vcl-mode buffers.") 67 "Abbreviation table used in vcl-mode buffers.")
68(c-define-abbrev-table 'vcl-mode-abbrev-table 68(c-define-abbrev-table 'vcl-mode-abbrev-table
69 '(("else" "else" c-electric-continued-statement 0) 69 '(("else" "else" c-electric-continued-statement 0)))
70 ("while" "while" c-electric-continued-statement 0)))
71 70
72;; Font locking 71;; Font locking
73(defconst vcl-font-lock-keywords-1 72(defconst vcl-font-lock-keywords-1
74 (eval-when-compile 73 (eval-when-compile
75 (list 74 (list
76 ;; Version declaration 75 ;; Version declaration
77 '("^[ \t]*\\(vcl\\)\\>[ \t]*\\([[:digit:]]+\\.[[:digit:]]+\\)" 76 '("^[ \t]*\\(vcl\\)\\>[ \t]*\\([[:digit:]]+\\.[[:digit:]]+\\)"
78 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 77 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
79 ;; Built-ins 78 ;; Built-ins
80 (cons 79 (cons
81 (concat "\\<" 80 (concat "\\<"
82 (regexp-opt 81 (regexp-opt
@@ -299,25 +298,25 @@
299 298
300(defconst vcl-font-lock-keywords-3 299(defconst vcl-font-lock-keywords-3
301 (append vcl-font-lock-keywords-2 300 (append vcl-font-lock-keywords-2
302 (eval-when-compile 301 (eval-when-compile
303 (list 302 (list
304 ;; User function names. 303 ;; User function names.
305 '("^[ \t]*\\(sub\\)\\>[ \t]*\\(\\sw+\\)?" 304 '("^[ \t]*\\(sub\\)\\>[ \t]*\\(\\sw+\\)?"
306 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))))) 305 (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)))))
307 "Gaudy level highlighting for VCL buffers.") 306 "Gaudy level highlighting for VCL buffers.")
308 307
309(defvar vcl-font-lock-keywords vcl-font-lock-keywords-3) 308(defvar vcl-font-lock-keywords vcl-font-lock-keywords-3)
310 309
311(put 'vcl-mode 'c-mode-prefix "vcl-") 310(put 'vcl-mode 'c-mode-prefix "vcl-")
312 311
313(defun vcl-sharp-comment-syntax () 312(defun vcl-sharp-comment-syntax ()
314 (save-excursion 313 (save-excursion
315 (goto-char (match-beginning 0)) 314 (goto-char (match-beginning 0))
316 (let ((syntax (save-match-data (syntax-ppss)))) 315 (let ((syntax (save-match-data (syntax-ppss))))
317 (cond 316 (cond
318 ((not (or (nth 3 syntax) (nth 4 syntax))) 317 ((not (or (nth 3 syntax) (nth 4 syntax)))
319 (put-text-property (match-beginning 1) (match-end 1) 318 (put-text-property (match-beginning 1) (match-end 1)
320 'syntax-table (string-to-syntax "<")) 319 'syntax-table (string-to-syntax "<"))
321 (end-of-line) 320 (end-of-line)
322 (put-text-property (point) (+ (point) 1) 321 (put-text-property (point) (+ (point) 1)
323 'syntax-table (string-to-syntax ">"))))))) 322 'syntax-table (string-to-syntax ">")))))))
@@ -351,26 +350,27 @@
351(add-to-list 'auto-mode-alist (cons (purecopy "\\.vcl\\'") 'vcl-mode)) 350(add-to-list 'auto-mode-alist (cons (purecopy "\\.vcl\\'") 'vcl-mode))
352 351
353;;;###autoload 352;;;###autoload
354(define-derived-mode vcl-mode prog-mode "VCL" 353(define-derived-mode vcl-mode prog-mode "VCL"
355 "Major mode for editing VCL code. 354 "Major mode for editing VCL code.
356 355
357Key bindings: 356Key bindings:
358\\{vcl-mode-map}" 357\\{vcl-mode-map}"
359 358
360 (set (make-local-variable 'syntax-propertize-function) 359 (set (make-local-variable 'syntax-propertize-function)
361 vcl-syntax-propertize-function) 360 vcl-syntax-propertize-function)
362 (set (make-local-variable 'parse-sexp-lookup-properties) t) 361 (set (make-local-variable 'parse-sexp-lookup-properties) t)
363 (set (make-local-variable 'comment-start) "# ")
364 362
365 (c-initialize-cc-mode t) 363 (c-initialize-cc-mode t)
364 (c-lang-setvar comment-start "# ")
365 (setq c-opt-cpp-prefix nil)
366 (set-syntax-table vcl-mode-syntax-table) 366 (set-syntax-table vcl-mode-syntax-table)
367 (setq local-abbrev-table vcl-mode-abbrev-table 367 (setq local-abbrev-table vcl-mode-abbrev-table
368 abbrev-mode t) 368 abbrev-mode t)
369 (use-local-map vcl-mode-map) 369 (use-local-map vcl-mode-map)
370 (c-init-language-vars vcl-mode) 370 (c-init-language-vars vcl-mode)
371 (c-common-init 'vcl-mode) 371 (c-common-init 'vcl-mode)
372 372
373 (c-run-mode-hooks 'c-mode-common-hook 'vcl-mode-hook) 373 (c-run-mode-hooks 'c-mode-common-hook 'vcl-mode-hook)
374 (c-update-modeline)) 374 (c-update-modeline))
375 375
376(provide 'vcl-mode) 376(provide 'vcl-mode)

Return to:

Send suggestions and report system problems to the System administrator.