[−][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 examples.
Re-exports
pub use failure; |
pub use failure::Error; |
Macros
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. |
GlobalRef | A "global reference" that can live outside the scope of an |
Value | A type that represents Lisp values.
Values of this type can be copied around, but are lifetime-bound to the |
Vector | A type that represents Lisp vectors. This is a wrapper around |
Enums
ErrorKind | Error types generic to all Rust dynamic modules. |
Traits
FromLisp | Converting Lisp |
IntoLisp | Converting a Rust type into Lisp |
ResultExt | Emacs-specific extension methods for |
Transfer | Allowing a type to be exposed to Lisp, where its values appear as opaque objects, or "embedded
user pointers" (printed as |
Type Definitions
Result | A specialized |
Attribute Macros
defun | Exports a function to the Lisp runtime. The function is bound when the module is loaded, even if it is defined inside another function which is never called. |
module | Registers a function as the initializer, to be called when Emacs loads the module. Each dynamic module must have one and only one such function. |