• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-1,541989

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

CHANGELOG.mdH A D05-Aug-20195.5 KiB11293

Cargo.tomlH A D01-Jan-19701.5 KiB4840

Cargo.toml.orig-cargoH A D05-Aug-20191 KiB4339

README.mdH A D03-Aug-20192.2 KiB5539

README.md

1# Emacs Module in Rust [![crates.io](https://meritbadge.herokuapp.com/emacs)](https://crates.io/crates/emacs) [![doc.rs](https://docs.rs/emacs/badge.svg)](https://docs.rs/emacs/) [![Build Status](https://travis-ci.org/ubolonton/emacs-module-rs.svg?branch=master)](https://travis-ci.org/ubolonton/emacs-module-rs) [![Build Status](https://dev.azure.com/ubolonton/emacs-module-rs/_apis/build/status/ubolonton.emacs-module-rs?branchName=master)](https://dev.azure.com/ubolonton/emacs-module-rs/_build/latest?definitionId=1&branchName=master)
2
3[User Guide](https://ubolonton.github.io/emacs-module-rs/) | [Change Log](https://github.com/ubolonton/emacs-module-rs/blob/master/CHANGELOG.md) | [Examples](https://github.com/ubolonton/emacs-module-rs#sample-modules)
4
5This provides a high-level binding to `emacs-module`, Emacs's support for dynamic modules.
6
7Code for a minimal module looks like this:
8
9```rust
10use emacs::{defun, Env, Result, Value};
11
12emacs::plugin_is_GPL_compatible!();
13
14#[emacs::module(name = "greeting")]
15fn init(_: &Env) -> Result<()> { Ok(()) }
16
17#[defun]
18fn say_hello(env: &Env, name: String) -> Result<Value<'_>> {
19    env.message(&format!("Hello, {}!", name))
20}
21```
22
23```emacs-lisp
24(require 'greeting)
25(greeting-say-hello "Emacs")
26```
27
28## Live Reloading
29
30Emacs does not support unloading modules. Live reloading thus requires a custom module loader. [rs-module](rs-module) is one such loader (which itself is a module that must be loaded by Emacs's normal loading mechanism). See [load.sh](bin/load.sh).
31
32**Note**: This doesn't work on macOS 10.13+ (High Sierra and up). See Rust's [issue #28794](https://github.com/rust-lang/rust/issues/28794#issuecomment-368693049).
33
34## Sample Modules
35
36- [test-module](test-module).
37- [emacs-rs-examples](https://github.com/ubolonton/emacs-rs-examples).
38- [pullover](https://github.com/ubolonton/pullover): Use Emacs to edit text for other macOS apps.
39- [magit-libgit2](https://github.com/ubolonton/magit-libgit2): Experimental attempt to speed up magit using libgit2.
40
41## Development
42
43- Building:
44    ```shell
45    cargo build --all
46    ```
47- Testing:
48    ```shell
49    bin/test.sh
50    ```
51- Continuous testing (requires `cargo-watch`):
52    ```shell
53    cargo watch -x 'build --all' -s bin/test.sh
54    ```
55