Blog IndexPosts by TagHome

Syntax Highlighting in Caffe Prototxt on Emacs

Posted <2016-03-15 Tue 15:30> by Aaron S. Jackson.

~/.emacs.d/caffe-mode.el

(setq caffe-mode-highlights
      '(("#+.*" . font-lock-comment-face)
    ("'.*'" . font-lock-string-face)
    (".*\s{\\|}" . font-lock-function-name-face)
    ("^\s*.+:" . font-lock-keyword-face)
    ("[A-Z]" . font-lock-constant-face)
    ("false\\|true" . font-lock-constant-face)
    ("[0-9]*.?[0-9]*e?[0-9]*" . font-lock-constant-face)
    (".*" . font-lock-defaults)
    ))

(define-derived-mode caffe-mode fundamental-mode
  (setq font-lock-defaults '(caffe-mode-highlights))
  (setq comment-start "#")
  (setq mode-name "Caffe"))

and to my init.el

(load-file "~/.emacs.d/caffe-mode.el")
(add-to-list 'auto-mode-alist '("\\.prototxt\\'" . caffe-mode))

Related posts:

Tags: emacs caffe

Blog IndexPosts by TagHome

You can verify this page with the following command:
gpg --verify <(curl -s http://aaronsplace.co.uk/blog/2016-03-21-caffe-emacs-syntax.asc) <(curl -s http://aaronsplace.co.uk/blog/2016-03-21-caffe-emacs-syntax.html)

Copyright 2007-2018 Aaron S. Jackson (compiled: Sun 3 Jun 13:24:57 BST 2018)