1

I'm using emacs for editing a bunch of matlab files. The only gripe that I have is that the syntax highlighting provided by octave-mode is pretty poor.

This is the syntax highlighting provided by sublime text, while this is emacs. On the right side is octave-mode, on the left is matlab-mode.

How can I have syntax highlighting for the keywords and numbers in emacs?

EDIT: I just found highlight-numbers-mode for the numbers, the only problem left is the keywords highlighting.

  • As a side note (if you're into this kind of thing) you can also have semantic highlighting of identifiers with [`rainbow-identifiers-mode`](https://github.com/Fanael/rainbow-identifiers). – ngmir May 25 '20 at 07:35

1 Answers1

1

octave-mode does have some keywords (see source). Even so, you can add your own:

(font-lock-add-keywords 'octave-mode
                        '(("\\<load\\>". font-lock-keyword-face)                                                                                                                           
                          ("\\<clear\\>". font-lock-keyword-face)))
Felipe Lema
  • 737
  • 3
  • 11