https://github.com/ubolonton/emacs-module-rs
Rust binding and tools for Emacs's dynamic modules
https://github.com/ubolonton/emacs-module-rs
binding emacs emacs-modules ffi rust
Last synced: 24 days ago
JSON representation
Rust binding and tools for Emacs's dynamic modules
- Host: GitHub
- URL: https://github.com/ubolonton/emacs-module-rs
- Owner: ubolonton
- Created: 2017-12-22T01:26:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-19T01:52:10.000Z (9 months ago)
- Last Synced: 2025-05-09T15:19:45.211Z (about 1 month ago)
- Topics: binding, emacs, emacs-modules, ffi, rust
- Language: Rust
- Homepage:
- Size: 622 KB
- Stars: 354
- Watchers: 13
- Forks: 23
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Emacs Module in Rust
[](https://crates.io/crates/emacs)
[](https://docs.rs/emacs/)
[](https://dev.azure.com/ubolonton/emacs-module-rs/_build/latest?definitionId=1&branchName=master)
[](https://github.com/ubolonton/emacs-module-rs/actions/workflows/main.yml)[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#example-modules)
This provides a high-level binding to `emacs-module`, Emacs's support for dynamic modules.
Code for a minimal module looks like this:
```rust
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> {
env.message(&format!("Hello, {}!", name))
}
``````emacs-lisp
(require 'greeting)
(greeting-say-hello "Emacs")
```## Example Modules
- [emacs-tree-sitter](https://github.com/ubolonton/emacs-tree-sitter): Binding for tree-sitter, an incremental parsing tool.
- [pullover](https://github.com/ubolonton/pullover): Use Emacs to edit text for other macOS apps.
- [test-module](test-module).
- [emacs-rs-examples](https://github.com/ubolonton/emacs-rs-examples).
- [magit-libgit2](https://github.com/ubolonton/magit-libgit2): Experimental attempt to speed up magit using libgit2.## Development
- Building:
```shell
bin/build
```
- Testing:
```shell
bin/test
```
- Continuous testing (requires `cargo-watch`):
```shell
bin/test watch
```On Windows, use PowerShell to run the corresponding `.ps1` scripts.