#emacs #emacs-module

emacs

Rust library for creating emacs modules

6 releases (breaking)

0.5.1 Mar 3, 2018
0.5.0 Feb 24, 2018
0.4.0 Feb 18, 2018
0.3.0 Jan 8, 2018
0.1.0 May 23, 2016

#7 in Text editors

Download history 13/week @ 2018-05-26 29/week @ 2018-06-02 3/week @ 2018-06-09 19/week @ 2018-06-16 7/week @ 2018-06-23 102/week @ 2018-06-30 6/week @ 2018-07-07 18/week @ 2018-07-21 13/week @ 2018-07-28 35/week @ 2018-08-04 18/week @ 2018-08-11 2/week @ 2018-08-18

48 downloads per month
Used in 1 crate

BSD-3-Clause

35KB
681 lines

Emacs Module in Rust crates.io doc.rs Build Status

User Guide | Example

This provides a high-level binding to emacs-module. Code for a minimal module looks like this:

extern crate libc;
#[macro_use]
extern crate emacs;

use emacs::{Env, CallEnv, Result, Value};

emacs_plugin_is_GPL_compatible!();
emacs_module_init!(init);

fn init(env: &Env) -> Result<Value> {
    fn hello(env: &CallEnv) -> Result<Value> {
        let name: String = env.parse_arg(0)?;
        env.message(&format!("Hello, {}!", name))
    }

    emacs_export_functions! {
        env, "greeting-", {
            "say-hello" => (hello, 1..1)
        }
    }

    env.provide("greeting")
}
(require 'greeting)
(greeting-say-hello "Emacs")

Live Reloading

Emacs does not support unloading modules. Live reloading thus requires a custom module loader. rs-module is one such loader (which itself is a module that must be loaded by Emacs's normal loading mechanism). See load.sh.

Sample Modules

test-module uses most of the provided features.

Development

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

Dependencies

~3MB
~60K SLoC