This gives Emacs awesome power!

Overview

WASI gives Emacs awesome power !!

This provides the ability to run WASI: WebAssembly System Interface program on Emacs.

This is still in the experimental stage.

This module is developed using wasmtime.

Build

$ cargo build

Usage

Set up the following in your emacs.

;; load wasm loader
(module-load "path/to/target/debug/libwasm_loader.so")
;; register wasm modules
(wasm-loader/load "path/to/wasm-dir/")

Use wasm-loader/call to run program on WASI.

;; call hello.wasm
(message (wasm-loader/call "hello" "test" "{ \"name\": \"WASM\" }"))

Emacs interface for WASI

Basically, stdio is used to communicate with program.

To run on WASI, use the function wasm-loader/call.

This function takes three arguments.

  1. wasm module name (this is the file name with the extension removed)
  2. command type argument (e.g., get, setting )
  3. command argument body (This is passed to the stdio. e.g., JSON for RPC requests)

WASI program reads the 2 and 3.

Here is a simple example of a program.

see examples/hello/main.rs .

use serde::{Deserialize, Serialize};
use std::io::{self, Read};

#[derive(Serialize, Deserialize, Debug)]
struct Request {
    name: String,
}

#[derive(Serialize, Deserialize, Debug)]
struct Response {
    command: String,
    name: String,
}

// This is a sample program that uses stdio to exchange values using the JSON format.
fn main() {
    // Reads args from Emacs from stdin.
    let mut raw_stdin: Vec<u8> = Vec::new();
    let mut stdin = io::stdin();
    stdin.read_to_end(&mut raw_stdin).ok();

    // convert
    let input: String = String::from_utf8(raw_stdin).unwrap();
    // deserialize
    let req: Request = serde_json::from_str(&input).unwrap();

    // create return response
    let mut res = Response {
        command: "".to_string(),
        name: format!("hello {}", req.name),
    };

    let args: Vec<String> = std::env::args().collect();
    if !args.is_empty() {
        // get command type from args
        let arg = args[0].clone();
        res.command = arg;
    }

    // to json
    let serialized = serde_json::to_string(&res).unwrap();

    println!("{}", serialized);
}

build WASI program.

$ cd example/hello
$ cargo build --target wasm32-wasi
You might also like...
Emacs client for ycmd, the code completion system.

This package is currently unmaintained! If you want to take over maintenance, let me know in an issue. emacs-ycmd emacs-ycmd is a client for ycmd, the

crispmacs is a WIP implementation of Emacs from scratch in Rust.

crispmacs is a WIP implementation of Emacs from scratch in Rust.

rust cli project.el clone for those leaving emacs

R-Ject I was a longtime Emacs user and really miss the project management that came with projectile.el and project.el at the same time I was looking f

System76 Power Management

System76 Power Management system76-power is a utility for managing graphics and power profiles. Graphics Modes Integrated The integrated graphics cont

VR Lighthouse power state management in Rust

Lighthouse VR Lighthouse power state management in Rust Windows and Linux binaries available here Usage SteamVR v1: lighthouse [on|off] [BSID] lightho

The video game for Fonts of Power. A tabletop roleplaying game made in Rust with Bevy!

The code and rules for Fonts of Power, a tactical TTRPG / video game about exploring magical places. You can follow its development in our Discord ser

A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics.

A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics. This is an experiment that uses unstable features only available on nightly rust.

Turn off monitors to save power (for Wayland)

Same as xset dpms force off, but for Wayland. It requires zwlr_output_power_manager_v1 and org_kde_kwin_idle support from the Wayland compositer. wlro

Sample and plot power consumption, average frequency and cpu die temperatures over time.
Sample and plot power consumption, average frequency and cpu die temperatures over time.

sense Sense is a small tool to gather data on cpu temperature, power usage and clock frequency and plot graphs during some load. Dependencies Sense is

A simple power 4 game wrote in Rust.

๐Ÿ”ด ๐Ÿ”ต Power 4 This is a simple power 4 game wrote in native Rust. There's only one dependencie for colored terminal. โ“ How to try it? To try this game

Crypto in, power out

Cipo Crypto in, power out Cipo makes it easy to let users pay for electricity for their camper-van, electric cars, boat, caravan and other high load c

The free password manager for power users
The free password manager for power users

The free password manager for power users

Scaphandre is a metrology agent dedicated to electrical power consumption metrics.
Scaphandre is a metrology agent dedicated to electrical power consumption metrics.

Scaphandre [skafษ‘ฬƒdส] is a metrology agent dedicated to electrical power consumption metrics. The goal of the project is to permit to any company or individual to measure the power consumption of its tech services and get this data in a convenient form, sending it through any monitoring or data analysis toolchain.

A command line tool to control the power state of Valve Base Stations 2.0.

lighthousectl A command line tool to control the power state of Valve Base Stations 2.0. Usage Scan All Base Stations It scans endlessly. You can stop

Move multiple files, with the power of your editor

NOTE FOR USERS THAT WANT TO TRY THIS OUT! The current code on the master branch doesnโ€™t work as documented, as a newer more powerful interface is bein

Renders typst code blocks in Obsidian into images using Typst through the power of WASM!
Renders typst code blocks in Obsidian into images using Typst through the power of WASM!

Obsidian Typst Renders typst code blocks into images using Typst through the power of WASM! This is still very much in development, so suggestions/bug

Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux.

Maccha I hate coffee. Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux. Plugins Plugins are written in Rust (ot

Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API
Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API

A gateway that proxies signed requests to other APIs. Check the docs for more info. If you are looking for the managed version checkout this link http

Owner
pyspa
pyspa
Gives custom drugs to your terminal ๐Ÿ’Š

Linux on drugs ?? Gives custom drugs to your terminal ?? Output random colors really fast Installation ?? Arch Linux Linux on drugs is in the AUR yay

Skwal 3 Sep 10, 2022
A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models you subscribe to on Onlyfans.

OF-notifier A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models

Gentlemen Mercenary 10 Dec 20, 2022
An EVM low-level language that gives full control over the control flow of the smart contract.

Meplang - An EVM low-level language Meplang is a low-level programming language that produces EVM bytecode. It is designed for developers who need ful

MEP 19 Jan 31, 2023
Sero is a web server that allows you to easily host your static sites without pain. The idea was inspired by surge.sh but gives you full control.

sero Lightning-fast, static web publishing with zero configuration and full control ?? Table Of Contents ?? Table Of Contents ?? Tools โ“ About The Pro

Dmitry Miasnenko 6 Nov 13, 2023
Rust :heart: Emacs

Rust โค๏ธ Emacs A community-driven port of Emacs to Rust. Table of Contents Why Emacs? Why Rust? Why A Fork? Getting Started Requirements Dockerized dev

Remacs 4.5k Jan 2, 2023
Emacs configuration for Rust

Table of Contents Introduction Installation Melpa Manual installation Feature guide Indentation Code formatting Running / testing / compiling code Cli

The Rust Programming Language 919 Jan 4, 2023
Rust development environment for Emacs

Rustic Table of Contents Rustic Intro Installation straight Compilation Faces rustc errors Rustfmt edition 2018 LSP Server Client eglot lsp-mode lsp-e

null 612 Dec 30, 2022
Racer support for Emacs

Racer for Emacs This is the official Emacs package for Racer. Table of Contents Racer for Emacs Completion Find Definitions Describe Functions and Typ

null 398 Nov 30, 2022
Auto-Complete is an intelligent auto-completion extension for Emacs.

Auto-Complete is an intelligent auto-completion extension for Emacs. It extends the standard Emacs completion interface and provides an environment that allows users to concentrate more on their own work.

Emacs Auto-Complete 1.7k Dec 28, 2022
On the fly syntax checking for GNU Emacs

https://www.flycheck.org Modern on-the-fly syntax checking extension for GNU Emacs. Try it! For a more gentle introduction read the Installation instr

Flycheck 2.3k Dec 30, 2022