Dear All! I've been using emacs AUCTEX for quite a while and found it very convenient to work with. One issue is the lack of syntax highlighting. I've tried some elisp code and added the following hook when I'm in ConTeXt-mode: (add-hook 'ConTeXt-mode-hook (lambda () (font-lock-add-keywords nil '(("\\(\\\\starttext\\)\\>" 1 font-lock-warning-face t) ("\\(\\\\stoptext\\)\\>" 1 font-lock-warning-face t))))) and it seems to highlight the start-stop text keyword. So my question is: Is there a way to accomplish a similar way of highlighting all other keywords that belongs to the ConTeXt typesetting syntax? Maybe a REGEXP (I'm not good at writing those) can do this in some way without manually write every start-stop sequence that exists. Have anyone, using AUCTEX, already did some customizing already who wants to share it with me. Many thanks in advance /Jan-Erik
Am 19.07.23 um 15:38 schrieb Jan-Erik Hägglöf:
Dear All! I've been using emacs AUCTEX for quite a while and found it very convenient to work with.
One issue is the lack of syntax highlighting.
https://wiki.contextgarden.net/Text_Editors says, Emacs has ConTeXt support including syntax highlighting. I don’t use Emacs, so I don’t know how to activate/configure it. Maybe it expects a different file extension, like .ctx? Hraban
It does not highlight e.g \starttext keyword by default. The colorscheme seems adapted to LaTeX mode so I managed to fix this now for all \start - \stop commands with this code put in ~/.emacs.d/init.el (add-hook ’ConTeXt-mode-hook (lambda () (font-lock-add-keywords nil ’((”\\(\\\\start\\w*\\)\\>” 1 font-lock-function-name-face t) (”\\(\\\\stop\\w*\\)\\>” 1 font-lock-function-name-face t))))) And the regexp was done with help from interactive inbuilt function re-builder in emacs The next goal is to highlight variabels like \textwidth for example Thanks for feedback /Jan-erik Skickat från min iPhone
19 juli 2023 kl. 17:20 skrev Henning Hraban Ramm
: Am 19.07.23 um 15:38 schrieb Jan-Erik Hägglöf:
Dear All! I've been using emacs AUCTEX for quite a while and found it very convenient to work with. One issue is the lack of syntax highlighting.
https://wiki.contextgarden.net/Text_Editors says, Emacs has ConTeXt support including syntax highlighting.
I don’t use Emacs, so I don’t know how to activate/configure it. Maybe it expects a different file extension, like .ctx?
Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________
participants (3)
-
Henning Hraban Ramm
-
Jan-Erik Hägglöf
-
skrantajanneman@gmail.com