1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
//! 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))
//! }
//! ```
//!
//! ```emacs-lisp
//! (require 'greeting)
//! (greeting-say-hello "Emacs")
//! ```
//!
//! See [User Guide] and [examples].
//!
//! [User Guide]: https://ubolonton.github.io/emacs-module-rs/
//! [Examples]: https://github.com/ubolonton/emacs-rs-examples/
#[doc(inline)]
pub use emacs_macros::{defun, module};
#[doc(inline)]
pub use self::{
env::Env,
value::Value,
global::{GlobalRef, OnceGlobalRef},
types::{FromLisp, IntoLisp, Transfer, Vector},
func::CallEnv,
error::{ErrorKind, Result, ResultExt, Error},
};
#[macro_use] mod macros;
#[doc(hidden)]
pub mod init;
#[doc(hidden)]
pub mod func;
mod env;
mod value;
mod types;
mod error;
mod call;
#[macro_use]
mod global;
mod symbol;
mod subr;
/// This exposes some raw types for module to use (e.g. in `emacs_module_init`) without having to
/// declare the raw `emacs_module` as a dependency.
#[doc(hidden)]
pub mod raw {
pub use emacs_module::{emacs_runtime, emacs_env, emacs_value};
}
/// External dependencies that are mostly used by macros instead of user code.
#[doc(hidden)]
pub mod deps {
pub use emacs_macros;
pub use ctor;
}