all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Aurélien Aptel" <aurelien.aptel+emacs@gmail.com>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: Tom Tromey <tom@tromey.com>,
	syohex@gmail.com,
	Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: good examples of Emacs modules?
Date: Thu, 31 Mar 2016 23:29:19 +0200	[thread overview]
Message-ID: <CA+5B0FMs08XnqRLvFD+EzAMohoDYxffXLE92bwwD4=EmesFJCA@mail.gmail.com> (raw)
In-Reply-To: <87twjm5rc3.fsf@wanadoo.es>

Hi all,

On Thu, Mar 31, 2016 at 10:23 PM, Óscar Fuentes <ofv@wanadoo.es> wrote:
> consequences.) How objects created by the module system interact with
> garbage collection is an start.

Every emacs_value allocated inside a Lisp-exposed function becomes
invalid when control of the function ends (when it exits) unless you
return that value or you mark it global with the the
env->make_global_ref() API call.

As I was googling for a browseable emacs git repo to look quickly at
emacs-module.h I've noticed that Syohei Yoshida (cc'ed) has figured a
lot of things out by himself (kudos to you!) and has already made some
simple and not-so-simple modules:

- dead simple module that exposes an ioctl syscall to Lisp
  https://github.com/syohex/emacs-eject

- json parser/encoder
  https://github.com/syohex/emacs-parson
  this one is interesting because he has done some benchmarks!

- libGeoIP binding
  https://github.com/syohex/emacs-geoip

- libbarcode binding
  https://github.com/syohex/emacs-barcode

- libmemcached binding
  https://github.com/syohex/emacs-memcached

- libyaml binding
  https://github.com/syohex/emacs-libyaml

- libqrencode binding
  https://github.com/syohex/emacs-qrencode

- embedded Lua interpreter
  https://github.com/syohex/emacs-lua

- embedded Ruby interpreter
  https://github.com/syohex/emacs-mruby-test

- wrapper that lets you implement modules in Nim
  https://github.com/yuutayamada/nim-emacs-module

I've looked briefly at most of them and I think they are good
examples. Especially how he only implements low-level functionality of
package xyz in a xyz-core module which is exactly how I envisioned it.

- Tom Tromey has also made a binding on libffi which means you can
call C stuff from Lisp without writing a module.
  https://github.com/tromey/emacs-ffi

It seems the japanese-speaking Emacs community has picked up on the
modules feature quite fast. I found several article/blog about it. Too
bad I can't read it, it looks interesting :)

- article on how the emacs-eject module was done
  http://syohex.hatenablog.com/entry/2015/12/16/185458
- article on the module feature with *benchmarks* and side-by-side
code comparison. Very cool!
  http://coldnew.github.io/blog/2015/01/03_emacsdynamic/

Syohei, I really like what you did and I would be interested in your
feedback on what could be improved, what should we add&optimize in the
module API, etc.

Thanks!



  reply	other threads:[~2016-03-31 21:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 23:17 good examples of Emacs modules? Paul Eggert
2016-03-31 14:49 ` Aurélien Aptel
2016-03-31 15:34   ` Óscar Fuentes
2016-03-31 16:53     ` Eli Zaretskii
2016-03-31 17:07       ` Óscar Fuentes
2016-03-31 17:39         ` Eli Zaretskii
2016-03-31 20:23           ` Óscar Fuentes
2016-03-31 21:29             ` Aurélien Aptel [this message]
2016-03-31 21:59               ` Óscar Fuentes
2016-04-01  7:18                 ` Eli Zaretskii
2016-04-01 13:20                   ` Óscar Fuentes
2016-04-01 14:02                     ` Eli Zaretskii
2016-04-02  2:10               ` Syohei Yoshida
2016-05-03 20:48                 ` Philipp Stephani
2016-05-03 22:16                   ` Stefan Monnier
2016-04-01  6:23             ` Eli Zaretskii
2016-04-01 13:25               ` Óscar Fuentes
2016-04-01 14:07                 ` Eli Zaretskii
2016-05-03 20:54   ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+5B0FMs08XnqRLvFD+EzAMohoDYxffXLE92bwwD4=EmesFJCA@mail.gmail.com' \
    --to=aurelien.aptel+emacs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=ofv@wanadoo.es \
    --cc=syohex@gmail.com \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.