ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Custom highlight ConTeXt syntax in AUCTEX
@ 2023-07-19 13:38 Jan-Erik Hägglöf
  2023-07-19 15:18 ` [NTG-context] " Henning Hraban Ramm
  0 siblings, 1 reply; 3+ messages in thread
From: Jan-Erik Hägglöf @ 2023-07-19 13:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 975 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1367 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Custom highlight ConTeXt syntax in AUCTEX
  2023-07-19 13:38 [NTG-context] Custom highlight ConTeXt syntax in AUCTEX Jan-Erik Hägglöf
@ 2023-07-19 15:18 ` Henning Hraban Ramm
  2023-07-19 20:48   ` skrantajanneman
  0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2023-07-19 15:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Custom highlight ConTeXt syntax in AUCTEX
  2023-07-19 15:18 ` [NTG-context] " Henning Hraban Ramm
@ 2023-07-19 20:48   ` skrantajanneman
  0 siblings, 0 replies; 3+ messages in thread
From: skrantajanneman @ 2023-07-19 20:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1805 bytes --]

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 <texml@fiee.net>:
> 
> 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
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 3527 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-19 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19 13:38 [NTG-context] Custom highlight ConTeXt syntax in AUCTEX Jan-Erik Hägglöf
2023-07-19 15:18 ` [NTG-context] " Henning Hraban Ramm
2023-07-19 20:48   ` skrantajanneman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).