I'm writing a syntax highlighting mode for emacs, and wondering if there is a way to improve my workflow.
Currently I do this:
- make edits to
mymode.el
- restart emacs
- open
mymode.el
- eval buffer
- open a file with the language to see the changes
Is there a way to quickly display the results of syntax mode changes, preferably without having to reload emacs?
[EDIT]
My font faces are defined using (defface...
like so:
(defface my-lang-comment-face '((t (:inherit font-lock-comment-face)))
"comments" :group 'my-lang)
Should I be using defconstant
or setq
instead during development, then change it to defface
when it's "done"?
C-x k
. Then delete steps 2 and 3. Your new loop should be steps 1, 4, 5 and 6.mymode.el
. The old syntax table is not replaced when I eval the mode. However I can doM-x describe-variable RET my--syntax-table
and selectForget
, confirm, then reload the mode and revisit the language file. But this is not better than restarting emacs. Really I just want to "reload" the entire mode, overwriting previous definitions with the new ones, but I can't figure out how to do that without restarting emacs.(defconst my-syntax-table ...)
rather than(defvar my-syntax-table ...)
then I can actuallyeval-buffer
and then reload the language buffer to see changes! I learned to usedefconst
if I want to be able to change the thing, versusdefvar
when it should never change. Great naming scheme there, thanks Emacs.