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))

Wanting to leave a comment?

Comments and feedback are welcome by email (aaron@nospam-aaronsplace.co.uk).

Related posts:

Tags: emacs caffe

Blog IndexPosts by TagHome

Copyright 2007-2024 Aaron S. Jackson (compiled: Mon 30 Sep 12:34:17 BST 2024)