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

Copyright 2007-2017 Aaron S. Jackson (modified: Sun 23 Jul 14:30:50 BST 2017)