English | 简体中文
Cloel is a collaborative programming framework that combines Clojure and Elisp, leveraging Clojure's ecosystem and multi-threading capabilities to extend Emacs.
Key advantages:
- Speed: Time-consuming code runs in an external Clojure process, avoiding Emacs freezes
- Multi-threading: Utilizes Clojure's multi-threading to ensure fast responsiveness
- Lisp style: Write plugins in Clojure while maintaining a Lisp style
- Powerful ecosystem: Access to JVM and Python software package ecosystems
- Low barrier: Out-of-the-box framework, simplifying Clojure extension development for Emacs
-
Install Clojure, refer to the official guide
-
Install parseedn
-
Install Cloel Elisp part:
- Clone the repository and add to your Emacs configuration:
(add-to-list 'load-path "<path-to-cloel>") (require 'cloel)
-
Install Cloel Clojure part:
cd cloel clojure -X:jar clojure -X:install
-
Test:
- Execute
M-x load-file
and selectcloel/demo/app.el
- Run
M-x cloel-demo-test
- If "Cloel rocks!" is displayed, installation is successful. If not, check the
*cloel-demo-clojure-server*
buffer for error messages
- Execute
After each update of Cloel, you need to execute clojure -X:jar; clojure -X:install
to update the Clojure code.
During development, you can use the grep "STEP" keyword to understand the structure of the Demo program.
Below are the API details, replace app
with your application name:
Elisp API:
cloel-register-app
: Register an application. You need to input the application name, application directory, alias, and clj-type. The alias can be eitherclojure
orbb
.cloel-app-start/stop/restart-process
: Manage the Clojure processcloel-app-send-message
: Elisp asynchronously sends messages to Clojurecloel-app-call-async
: Elisp asynchronously calls Clojure functionscloel-app-call-sync
: Elisp synchronously calls Clojure functions
Clojure API:
cloel/start-server
: Start the Clojure processcloel/elisp-show-message
: Clojure asynchronously displays messages in the minibuffercloel/elisp-get-var
: Clojure synchronously gets Elisp variable valuescloel/elisp-eval-async
: Clojure asynchronously calls Elisp functionscloel/elisp-eval-sync
: Clojure synchronously calls Elisp functions
Interfaces that can be reloaded in Clojure:
handle-client-async-call
: Interface for handling Elisp asynchronous calls to Clojure functionshandle-client-sync-call
: Interface for handling Elisp synchronous calls to Clojure functionshandle-client-message
: Interface for handling Elisp asynchronously sending messages to Clojurehandle-client-connected
: Interface for when the Client connects to the Clojure process
In Clojure, we can use alter-var-root
to reload the above interface implementations on the application side. For specifics, please refer to demo/app.clj
- reorder-file: Automatically reorders numbering within files
- cloel-rand-quote: Insert a random quote