Emacs Module Bindings
This crate provides access to the new Emacs module
functionality recently
introduced in Emacs 25.
Usage aka How to write an oxidized Emacs module in a few easy steps
- 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 - Add the following dependencies:
= "0.2.34" = { = "$EMB_PATH" }
- Add
- Add the following to your
src/lib.rs
:extern crate libc; extern crate emacs; use ; emacs_plugin_is_GPL_compatible!; emacs_module_init!;
- 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.
For a more elaborate example, check out test-module.
Development
- Building:
cargo build --all
- Testing:
bin/test.sh
- Continuous testing (requires
cargo-watch
):cargo watch -x 'build --all' -s bin/test.sh