knupfer / haskell-emacs

Write Emacs extensions in Haskell
376 stars 22 forks source link

Use the new module support coming in Emacs 25 #60

Open jwiegley opened 7 years ago

jwiegley commented 7 years ago

This is a great project! I wonder if you could achieve even better integration by using the new support for dynamically loaded C modules coming in Emacs 25.1. It would require a little more boilerplate to get a Haskell library "ready" for inclusion into Emacs, but it should eliminate some of the marshalling overhead in some cases.

mwotton commented 7 years ago

Hi John!

I discussed this with Florian a little while ago - don't think he'll mind me posting.

Florian: """ I must confess that I didn't know about the native modules. It seems to me that the only advantage of the native modules are the avoidance of the pipe overhead, but with the big disadvantage of having to recompile emacs and not beeing able to distribute via melpa.

I guess I'll wait a bit and look how it works """

Me: """" I don't think you have to recompile emacs - it loads .so files. I think you could use the same model - I started with https://github.com/mwotton/emacsplugin which shows how you can compile a .so separately, then require it in emacs.

I agree that unless you can show the pipe overhead is really killing you it doesn't make much sense, and in any case it'll take a while for everyone to upgrade to 25. """

jwiegley commented 7 years ago

You are right, recompiling Emacs is not necessary. And also that if the overhead isn't killing you (if the module is largely computational, with small inputs and outputs), then piping is perfectly fine.

knupfer commented 7 years ago

Hey John, what an honor to read your words on my tiny hobbyist project (I've actually got a totally different profession). At least for now, I'd suggest to ignore the overhead until there pops up a high perf usecase, or are you limited in a specific case?

jwiegley commented 7 years ago

You are right, @knupfer, ignoring until a pressing need arises is the wise course. Good luck with your totally different profession! :)

sboosali commented 7 years ago

@jwiegley is there a tutorial for emacs modules? I'd like to make a "hello world" modules that (say) sorts a buffer via haskell.

jwiegley commented 7 years ago

This looks like it may be a good starting point, although I have not tried it yet myself: http://diobla.info/blog-archive/modules-tut.html

sboosali commented 7 years ago

Thanks!

Yeah, I saw that a few months ago, but I thought you could load the module dynamically, without recompiling Emacs (or i've misunderstood the process).

On Fri, Jan 20, 2017 at 4:02 PM, John Wiegley notifications@github.com wrote:

This looks like it may be a good starting point, although I have not tried it yet myself: http://diobla.info/blog-archive/modules-tut.html

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/knupfer/haskell-emacs/issues/60#issuecomment-274211980, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMZbOzmyKCquD8fxJqn6G_DmhOSZIks5rUUsjgaJpZM4Jw6kD .

--

(this message was composed with dictation: charitably interpret typos)Sam Boosalis

jwiegley commented 7 years ago

Yeah, I saw that a few months ago, but I thought you could load the module dynamically, without recompiling Emacs (or i've misunderstood the process).

Ah, then I didn't read carefully enough. Try this instead: http://nullprogram.com/blog/2016/11/05/

sboosali commented 7 years ago

This is extremely helpful, thanks again!

On Fri, Jan 20, 2017 at 6:21 PM, John Wiegley notifications@github.com wrote:

Yeah, I saw that a few months ago, but I thought you could load the module dynamically, without recompiling Emacs (or i've misunderstood the process).

Ah, then I didn't read carefully enough. Try this instead: http://nullprogram.com/blog/2016/11/05/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/knupfer/haskell-emacs/issues/60#issuecomment-274226138, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMcV6BNwnpgWig71VXZp2o-qw28iSks5rUWvAgaJpZM4Jw6kD .

--

(this message was composed with dictation: charitably interpret typos)Sam Boosalis