emacs 0.2.0

Rust library for creating emacs modules

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

  1. Create a new Cargo lib project, say my_fancy_module
  2. Open up Cargo.toml in an editor, and:
    • Add crate-type = ["cdylib"] to the [lib] section
    • Add the following dependencies:
    libc = "0.2.34"
    emacs = { path = "$EMB_PATH" }
  3. Add the following to your src/lib.rs:
    extern crate libc;
    extern crate emacs;
    use emacs::{Env, Result, EmacsVal};
    pub fn init(env: &mut Env) -> Result<EmacsVal> {
        // Add any other things you need the module to do here
  4. Execute cargo build
  5. If you're on OS X, copy target/debug/libmy_fancy_module.dylib to target/debug/libmy_fancy_module.so
  6. 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.


  • Building:
    cargo build --all
  • Testing:
  • Continuous testing (requires cargo-watch):
    cargo watch -x 'build --all' -s bin/test.sh