[][src]Crate emacs

This provides a high-level binding to emacs-module, Emacs's support for dynamic modules.

Code for a minimal module looks like this:

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

emacs::plugin_is_GPL_compatible!();

#[emacs::module(name = "greeting")]
fn init(_: &Env) -> Result<()> { Ok(()) }

#[defun]
fn say_hello(env: &Env, name: String) -> Result<Value<'_>> {
    env.message(&format!("Hello, {}!", name))
}
(require 'greeting)
(greeting-say-hello "Emacs")

See User Guide and example.

Re-exports

pub use emacs_macros::defun;
pub use emacs_macros::module;
pub use failure::Error;
pub use failure::ResultExt;

Macros

export_functions

Exports Rust functions to the Lisp runtime. #[defun] is preferred over this low-level interface.

module_init

Registers a function as the initialization hook. #[module] is preferred over this low-level interface.

plugin_is_GPL_compatible

Declares that this module is GPL-compatible. Emacs will not load it otherwise.

Structs

Env

Main point of interaction with the Lisp runtime.

Value

A type that represents Lisp values. Values of this type can be copied around, but are lifetime-bound to the Env they come from.

Enums

ErrorKind

Error types generic to all Rust dynamic modules.

Traits

FromLisp

Converting Lisp Value into a Rust type.

IntoLisp

Converting a Rust type into Lisp Value.

Transfer

Allowing a type to be exposed to Lisp, where its values appear as opaque objects, or "embedded user pointers" (printed as #<user-ptr ...>).

Type Definitions

Result

A specialized Result type for Emacs's dynamic modules.