Emacs Module Bindings
This crate provides access to the new Emacs module
functionality recently
introduced in Emacs 25. It's a basic FFI with a relatively straightforward
API. Have have a look at the source for details.
Usage aka How to write an oxidized Emacs module in a few easy steps
- Clone this project to some
$EMB_PATH
- Create a new Cargo
lib
project, saymy_fancy_module
- Open up
Cargo.toml
in an editor, and:- Add
crate-type = ["cdylib"]
to the[lib]
section (NOTE: Only Rust nightly correctly handles this at the moment) - Add the following dependencies:
= "0.2.14" = { = "$EMB_PATH" }
- Add
- Add the following to your
src/lib.rs
:extern crate libc; extern crate emacs_module_bindings as emacs; use ; /// This states that the module is GPL-compliant. /// Emacs won't load the module if this symbol is undefined. pub static plugin_is_GPL_compatible: c_int = 0; pub extern "C"
- Execute
cargo build
- If you're on OS X, copy
target/debug/libmy_fancy_module.dylib
totarget/debug/libmy_fancy_module.so
- Load it in emacs with
(require 'my-fancy-module "/path/to/libmy_fancy_module.so")
. Note that this requires Emacs to be configured and compiled with the--with-modules
flag.