emacs-module: Utilities to write Emacs dynamic modules

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This package provides a full set of bindings to emacs-module.h that allows to develop Emacs modules in Haskell. Bindings are based on Emacs 28 version of the interface and thus should work in all subsequent versions of Emacs, but will now work with earlier versions.

For pointers on how to write minimal Emacs module, please refer to tutorial https://github.com/sergv/emacs-module/blob/master/Tutorial.md.

Entry point: Emacs.Module module.


[Skip to Readme]

Properties

Versions 0.1, 0.1.1, 0.1.1.1, 0.2, 0.2, 0.2.1
Change log Changelog.md
Dependencies base (>=4.16 && <5), bytestring, deepseq, exceptions, filepath (>=1.4.100), monad-control, monad-interleave (>=0.2), mtl (>=2.3), prettyprinter (>=1.7), prettyprinter-combinators, primitive, template-haskell, text (>=2), transformers-base, tuples-homogenous-h98, vector (>=0.13), void [details]
License Apache-2.0
Author Sergey Vinokurov
Maintainer Sergey Vinokurov <serg.foo@gmail.com>
Category Foreign, Foreign binding
Home page https://github.com/sergv/emacs-module
Source repo head: git clone https://github.com/sergv/emacs-module.git
Uploaded by SergeyVinokurov at 2023-05-09T00:00:17Z

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
call-stacks

Enable call stacks

Disabled
assertions

Enable runtime assertions

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for emacs-module-0.2

[back to package description]

A Haskell package for writing Emacs modules

Why would anyone want to write Emacs modules in Haskell?

Emacs Lisp is not a young language and can go quite a long way, but it has a couple of issues that are not going to be solved any time soon:

FAQ

How do I start writing my own extensions?

Some day there will be a proper tutorial for using this package. For the time being the best place to start is this package’s tests.

What about Windows?

It works, Cabal can build a dll for you.

The haskell-emacs aims to address the same problem - writing Emacs extensions in Haskell, but uses different approach. It seems to use some kind of marshalling scheme to make Emacs data available in Haskell with a caveat that not all Emacs types can be converted (e.g. buffers cannot be typically serialised). Presumably, an extension built with this project will look like an executable that reads sexps from stdin and produces output on stdout. Or, possibly, as a daemon process that communicates with Emacs over network.

This project is a bit different. It wraps Emacs C API for writing new extensions that can manipulate Emacs values directly, without marhsalling. In this approach, an extension will look like a shared library/dll that can be loaded by standard emacs with (load "/tmp/libmy-ext.so").

Is there a tutorial?

It’s at https://github.com/sergv/emacs-module/blob/master/Tutorial.md.

Supported GHC versions

Tested with GHC 9.2, 9.4, 9.6.