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:
Wanting to leave a comment?
Comments and feedback are welcome by email (aaron@nospam-aaronsplace.co.uk).