all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question about syntax coloring using an external program
@ 2023-10-15 14:01 Fredrik Öhrström
  2023-10-15 15:34 ` Basile Starynkevitch
  0 siblings, 1 reply; 3+ messages in thread
From: Fredrik Öhrström @ 2023-10-15 14:01 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to invoke an external program to do syntax coloring and
formatting of the source inside an emacs buffer. I have created an elisp
solution using font-lock mode an regexes, but I would like a 100% correct
coloring solution. It suppose it could be implemented in pure elisp, but
for the moment I need to use an external program to do this. The external
program can annotate the source with tags that probably can be used by
emacs to color the source.

However I am at a loss how to actually implement such a round trip in emacs.
I would greatly appreciate any pointers to similar existing solutions or
hints on how to do it!

Many thanks!

//Fredrik


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

* Re: Question about syntax coloring using an external program
  2023-10-15 14:01 Question about syntax coloring using an external program Fredrik Öhrström
@ 2023-10-15 15:34 ` Basile Starynkevitch
  2024-01-11 12:01   ` Fredrik Öhrström
  0 siblings, 1 reply; 3+ messages in thread
From: Basile Starynkevitch @ 2023-10-15 15:34 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: team@refpersys.org

Hello all,

On 10/15/23 16:01, Fredrik Öhrström wrote:
> I would like to invoke an external program to do syntax coloring and
> formatting of the source inside an emacs buffer. I have created an elisp
> solution using font-lock mode an regexes, but I would like a 100% correct
> coloring solution. It suppose it could be implemented in pure elisp, but
> for the moment I need to use an external program to do this. The external
> program can annotate the source with tags that probably can be used by
> emacs to color the source.
>
> However I am at a loss how to actually implement such a round trip in emacs.
> I would greatly appreciate any pointers to similar existing solutions or
> hints on how to do it!

I am assuming you use GNU emacs (a recent one) on a GNU/Linux computer.

In theory you could use approaches inspired by the following GNU emacs 
extensions:

The ocaml merlin and tuareg modes:

> https://ocaml.github.io/merlin/editor/emacs/

Since the ocaml compiler (i.e. ocamlc or ocamlopt) can compute typing 
information (e.g. if you compile Ocaml source foo.ml with ocamlc 
-bin-annot foo.ml, a binary file foo.cmt is created, containing type 
information; which is exploitable with another utility by emacs).


Another approach involves the language server protocol LSP: See 
https://en.wikipedia.org/wiki/Language_Server_Protocol 
<https://en.wikipedia.org/wiki/Language_Server_Protocol>

(I believe /LSP/ is somehow supported in some extensions of recent GNU 
emacs)


Yet another approach would involve GNU emacs extensibility (this might 
require patching GNU emacs source code); see its file src/dynlib.c

(since dlopen seems to be callable from GNU emacs). See 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Dynamic-Modules.html 
and 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-Dynamic-Modules.html

Whatever approach you take, please explain it on some public mailing 
list, and if possible publish your code (with a GNU emacs compatible 
license, perhaps GPLv3+).

In the RefPerSys open source inference engine project (see 
https://github.com/RefPerSys/RefPerSys/ ....), we would need (in a few 
months) to do something similar.

Thanks

-- 
Basile Starynkevitch -http://starynkevitch.net/Basile/
email:<basile@starynkevitch.net>  (near Paris, France)
only mines opinions - les opinions sont seulement miennes


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

* Re: Question about syntax coloring using an external program
  2023-10-15 15:34 ` Basile Starynkevitch
@ 2024-01-11 12:01   ` Fredrik Öhrström
  0 siblings, 0 replies; 3+ messages in thread
From: Fredrik Öhrström @ 2024-01-11 12:01 UTC (permalink / raw)
  To: Basile Starynkevitch; +Cc: help-gnu-emacs, team@refpersys.org

Thank you Basile!

Another approach involves the language server protocol LSP: See
>

Many thanks for this info! LSP sounds great. :-)


> Yet another approach would involve GNU emacs extensibility (this might
> require patching GNU emacs source code); see its file src/dynlib.c
>

Interesting!

Whatever approach you take, please explain it on some public mailing
> list, and if possible publish your code (with a GNU emacs compatible
> license, perhaps GPLv3+).
>

The language and tool is now public here: https://libxmq.org
and the source is MIT licensed and available here:
https://github.com/libxmq/xmq/

//Fredrik


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

end of thread, other threads:[~2024-01-11 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-15 14:01 Question about syntax coloring using an external program Fredrik Öhrström
2023-10-15 15:34 ` Basile Starynkevitch
2024-01-11 12:01   ` Fredrik Öhrström

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.