Emacs Lisp syntax highlighting
Asked Answered
K

5

5

I want to write a syntax highlighting extension for Emacs, but I Googling of variations on "emacs syntax highlight tutorial" have all failed. How do I go about learning how to write an Emacs highlighter? What good resources are there for learning how to do such things?

Kneehigh answered 15/5, 2009 at 4:9 Comment(0)
S
13

You're looking in the wrong place. Look at "font-lock-mode".

Swindle answered 15/5, 2009 at 4:15 Comment(1)
This looks awesome. I will definitely investigate this further when it's not 1:40 in the morning.Kneehigh
B
5

There's a related question, on how to define a major mode with syntax highlighting using 'define-generic-mode. The question focuses on figuring out how to get the syntax highlighting working.

Borszcz answered 15/5, 2009 at 6:23 Comment(0)
A
2

unfortunately you were searching for the wrong terms, "syntax highlighting" is not emacs vocabulary :). You should have searched for something like "write emacs mode".

There was already a question for this: "How to write an emacs mode for a new language" with some good pointers.

Aviary answered 15/5, 2009 at 6:48 Comment(0)
H
1

If you are interested in writing your own highlighting, another question covered this and may be of value to you. It included this code snippet:

(defun django-highlight-comments ()
  (interactive "p")
  (highlight-regexp "{%.*?%}" 'hi-orange))
(add-hook 'html-mode-hook 'django-highlight-comments)

Code courtesy of Ashutosh Mehra's answer.

Heaver answered 18/5, 2009 at 15:21 Comment(0)
S
0

http://a-kat.com/Emacs_Major_Modes.html

Subtorrid answered 19/9, 2009 at 8:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.