Ecaml
Writing Emacs plugin in OCaml
Install / Use
/learn @janestreet/EcamlREADME
Emacs packages in OCaml
Ecaml is a library for writing Emacs packages in OCaml. It uses Emacs
25 support for dynamic modules to load native OCaml code into Emacs.
Building a plugin
First you build the plugin as a shared object (e.g. my_plugin.so).
Then you use bin/dump-ecaml.sh to dump a wrapper Elisp file
which will perform top-level definitions and load that shared object.
Using Dune
Compile your plugin using (modes (native shared_object)) in the executable
stanza of your dune file. See example/dune.example
for an example.
Using Jane Street jenga rules
Simply add (only_shared_object true) to the executables stanza in
your jbuild. For instance:
(executables
((names (my_plugin))
(libraries (ecaml))
(only_shared_object true)))
Then build my_plugin.so with jenga. This has been tested in opam
using jane-build.
Using other build systems
You need to use the -output-complete-obj option of ocamlopt to
produce a self-contained shared object file. For instance to build the
plugin in the example/ directory:
$ ocamlfind ocamlopt -linkpkg -package ecaml -thread -output-complete-obj \
-runtime-variant _pic -pp ppx-jane example_plugin.ml -o example_plugin.so
Links
As of Emacs version 25, Emacs supports plugins. Here is the API:
http://git.savannah.gnu.org/cgit/emacs.git/tree/src/emacs-module.h?id=e18ee60b02d08b2f075903005798d3d6064dc013
Here's a tutorial:
http://diobla.info/blog-archive/modules-tut.html
Here's an example plugin:
http://git.savannah.gnu.org/cgit/emacs.git/tree/modules/mod-test/mod-test.c?id=e18ee60b02d08b2f075903005798d3d6064dc013
Licensing
Note that Emacs modules must be GPL compatible, so you must make sure that your work based on Ecaml is released under a GPL compatible license.
Ecaml itself is released under the Apache 2.0 license which is GPL compatible.
Related Skills
qqbot-channel
348.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.2k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
348.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
