unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs <-> Lua bridge
@ 2021-04-18  4:32 Eduardo Ochs
  2021-04-18  4:45 ` Eduardo Ochs
  0 siblings, 1 reply; 5+ messages in thread
From: Eduardo Ochs @ 2021-04-18  4:32 UTC (permalink / raw)
  To: Emacs developers

Hi list,

about a month ago I asked on the Lua mailing list if anyone there had
tried to create an Emacs module that would load Lua and then start a
Lua interpreter and let Emacs call it...

I received this answer,

  http://lua-users.org/lists/lua-l/2021-03/msg00084.html

and today I finally had time to compile that code on Debian and test
it. It looks prototype-ishy, but it is surprisingly functional - if we
run something that returns several values, like the second sexp here,

  (emlua-dostring "a = 22")
  (emlua-dostring "return a+33, '44', {}")

it retuns a vector like this,

  ["55" "44" "table: 0x55f5e0a15a10"]

with tostring-ed versions of all its return values, and if we run
something that yields an error it returns a string with Lua's error
message.

I haven't played much with it yet.
Happy hacking =),

  Eduardo Ochs
  http://angg.twu.net/#eev
  http://angg.twu.net/emacsconf2020.html



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

* Re: Emacs <-> Lua bridge
  2021-04-18  4:32 Emacs <-> Lua bridge Eduardo Ochs
@ 2021-04-18  4:45 ` Eduardo Ochs
  2021-04-18 20:16   ` michael schuldt
  0 siblings, 1 reply; 5+ messages in thread
From: Eduardo Ochs @ 2021-04-18  4:45 UTC (permalink / raw)
  To: Emacs developers

Ooops, I forgot the link to the version with my comments
and instructions to compile on Debian! Here it is:
  http://angg.twu.net/emacs-lua/emlua.cpp.html
  http://angg.twu.net/emacs-lua/emlua.cpp

Cheers =/,
  Eduardo

On Sun, 18 Apr 2021 at 01:32, Eduardo Ochs <eduardoochs@gmail.com> wrote:
>
> Hi list,
>
> about a month ago I asked on the Lua mailing list if anyone there had
> tried to create an Emacs module that would load Lua and then start a
> Lua interpreter and let Emacs call it...
>
> I received this answer,
>
>   http://lua-users.org/lists/lua-l/2021-03/msg00084.html
>
> and today I finally had time to compile that code on Debian and test
> it. It looks prototype-ishy, but it is surprisingly functional - if we
> run something that returns several values, like the second sexp here,
>
>   (emlua-dostring "a = 22")
>   (emlua-dostring "return a+33, '44', {}")
>
> it retuns a vector like this,
>
>   ["55" "44" "table: 0x55f5e0a15a10"]
>
> with tostring-ed versions of all its return values, and if we run
> something that yields an error it returns a string with Lua's error
> message.
>
> I haven't played much with it yet.
> Happy hacking =),
>
>   Eduardo Ochs
>   http://angg.twu.net/#eev
>   http://angg.twu.net/emacsconf2020.html



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

* Re: Emacs <-> Lua bridge
  2021-04-18  4:45 ` Eduardo Ochs
@ 2021-04-18 20:16   ` michael schuldt
  2021-04-19  7:40     ` Eduardo Ochs
  0 siblings, 1 reply; 5+ messages in thread
From: michael schuldt @ 2021-04-18 20:16 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

Awesome!

Several years ago I compiled the Lua interpreter into Emacs and added
functions for accessing each from the other.
It was just fun experimental software and is not supported or actively
developed and still has unresolved issues,
but might be of interest to you. This was before modules got added to Emacs.
You can check out the code here: https://github.com/mschuldt/luamacs


On Sat, Apr 17, 2021 at 9:46 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:

> Ooops, I forgot the link to the version with my comments
> and instructions to compile on Debian! Here it is:
>   http://angg.twu.net/emacs-lua/emlua.cpp.html
>   http://angg.twu.net/emacs-lua/emlua.cpp
>
> Cheers =/,
>   Eduardo
>
> On Sun, 18 Apr 2021 at 01:32, Eduardo Ochs <eduardoochs@gmail.com> wrote:
> >
> > Hi list,
> >
> > about a month ago I asked on the Lua mailing list if anyone there had
> > tried to create an Emacs module that would load Lua and then start a
> > Lua interpreter and let Emacs call it...
> >
> > I received this answer,
> >
> >   http://lua-users.org/lists/lua-l/2021-03/msg00084.html
> >
> > and today I finally had time to compile that code on Debian and test
> > it. It looks prototype-ishy, but it is surprisingly functional - if we
> > run something that returns several values, like the second sexp here,
> >
> >   (emlua-dostring "a = 22")
> >   (emlua-dostring "return a+33, '44', {}")
> >
> > it retuns a vector like this,
> >
> >   ["55" "44" "table: 0x55f5e0a15a10"]
> >
> > with tostring-ed versions of all its return values, and if we run
> > something that yields an error it returns a string with Lua's error
> > message.
> >
> > I haven't played much with it yet.
> > Happy hacking =),
> >
> >   Eduardo Ochs
> >   http://angg.twu.net/#eev
> >   http://angg.twu.net/emacsconf2020.html
>
>

[-- Attachment #2: Type: text/html, Size: 3024 bytes --]

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

* Re: Emacs <-> Lua bridge
  2021-04-18 20:16   ` michael schuldt
@ 2021-04-19  7:40     ` Eduardo Ochs
  2021-05-11  7:38       ` michael schuldt
  0 siblings, 1 reply; 5+ messages in thread
From: Eduardo Ochs @ 2021-04-19  7:40 UTC (permalink / raw)
  To: michael schuldt; +Cc: Emacs developers

Hi Michael,

this looks very interesting! What did you use it for?

Do you have plans to adapt your src/luamacs.c and make it into
something that can be loaded as a module? I am quite incompetent with
C, so I can't help you with the C side besides offering encouragement
and testing...

At this moment I have these short-term goals with the emlua module:

  1. Adapt https://github.com/edrx/edrxrepl to emlua,

  2. Use emlua to help me edit the files into which I throw
     interesting URLs compulsively when I am browsing the web in
     half-brain-dead mode,

One of my medium-term goals is to use emlua to turn Emacs into an
editor of derivation trees - see:

  http://angg.twu.net/dednat6/tug-slides.pdf

at this moment I have to edit them by hand, using rectangle commands
and picture mode, and some operations on them are hard to do... Note
that dednat6 has a mini-Forth inside, that is based on this:

  http://angg.twu.net/miniforth-article.html

And this may be somewhat related to the other stuff in your github
page...

  Cheers! =)
    Eduardo Ochs
    http://angg.twu.net/#eev

On Sun, 18 Apr 2021 at 17:16, michael schuldt <mbschuldt@gmail.com> wrote:
>
> Awesome!
>
> Several years ago I compiled the Lua interpreter into Emacs and added functions for accessing each from the other.
> It was just fun experimental software and is not supported or actively developed and still has unresolved issues,
> but might be of interest to you. This was before modules got added to Emacs.
> You can check out the code here: https://github.com/mschuldt/luamacs



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

* Re: Emacs <-> Lua bridge
  2021-04-19  7:40     ` Eduardo Ochs
@ 2021-05-11  7:38       ` michael schuldt
  0 siblings, 0 replies; 5+ messages in thread
From: michael schuldt @ 2021-05-11  7:38 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 2710 bytes --]

Hi Eduardo,

I didn't use it for anything. It was something a professor let me do for
credit while in university
because I was one unit short of the semester minimum.

I thought it would be useful as a faster and more mainstream way of
programming Emacs,
but it turns out I enjoy Emacs Lisp more so I found no motivation to
continue working on it.
For a while I stopped caring about what other people wanted to use and
started writing tools in
Emacs Lisp...I've managed to find the middle ground since then.

This was also before modules got added to Emacs so that wasn't an option,
it had to be compiled in.
Now that I'm thinking about it, I don't think this could be done with
modules.
It extends core data structures and modifies things like garbage
collection, I'm guessing
that's beyond the capability of a module.

Your mini-forth looks cool! I'll have to spend a bit more time checking it
out...later.
Unfortunately I've been a bit too busy for the fun esoteric stuff lately.

On Mon, Apr 19, 2021 at 12:41 AM Eduardo Ochs <eduardoochs@gmail.com> wrote:

> Hi Michael,
>
> this looks very interesting! What did you use it for?
>
> Do you have plans to adapt your src/luamacs.c and make it into
> something that can be loaded as a module? I am quite incompetent with
> C, so I can't help you with the C side besides offering encouragement
> and testing...
>
> At this moment I have these short-term goals with the emlua module:
>
>   1. Adapt https://github.com/edrx/edrxrepl to emlua,
>
>   2. Use emlua to help me edit the files into which I throw
>      interesting URLs compulsively when I am browsing the web in
>      half-brain-dead mode,
>
> One of my medium-term goals is to use emlua to turn Emacs into an
> editor of derivation trees - see:
>
>   http://angg.twu.net/dednat6/tug-slides.pdf
>
> at this moment I have to edit them by hand, using rectangle commands
> and picture mode, and some operations on them are hard to do... Note
> that dednat6 has a mini-Forth inside, that is based on this:
>
>   http://angg.twu.net/miniforth-article.html
>
> And this may be somewhat related to the other stuff in your github
> page...
>
>   Cheers! =)
>     Eduardo Ochs
>     http://angg.twu.net/#eev
>
> On Sun, 18 Apr 2021 at 17:16, michael schuldt <mbschuldt@gmail.com> wrote:
> >
> > Awesome!
> >
> > Several years ago I compiled the Lua interpreter into Emacs and added
> functions for accessing each from the other.
> > It was just fun experimental software and is not supported or actively
> developed and still has unresolved issues,
> > but might be of interest to you. This was before modules got added to
> Emacs.
> > You can check out the code here: https://github.com/mschuldt/luamacs
>

[-- Attachment #2: Type: text/html, Size: 3789 bytes --]

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

end of thread, other threads:[~2021-05-11  7:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-18  4:32 Emacs <-> Lua bridge Eduardo Ochs
2021-04-18  4:45 ` Eduardo Ochs
2021-04-18 20:16   ` michael schuldt
2021-04-19  7:40     ` Eduardo Ochs
2021-05-11  7:38       ` michael schuldt

Code repositories for project(s) associated with this public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).