Elisp SOURCE construction — a pure leaf.
Every fn here is a string builder: Clojure data in, elisp source text out. No editor connection, no evaluation, no state, no lifecycle. That is the whole point of the namespace existing separately.
WHY A LEAF AND NOT AN ADDON CAPABILITY: a host that builds elisp needs these functions at LOAD time and in unit tests, long before (and often without) any editor addon mounting. Publishing them as a runtime capability turns a pure function into a lifecycle dependency — the mount-order race that this library exists to remove. Evaluation is a capability; syntax is not.
Consumers: hive-emacs re-exports these as hive-emacs.elisp; hive-mcp reaches them directly, which is how the host stopped compile-depending on the addon for string construction.
Usage: (require '[hive-elisp.core :as el]) (el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) ;; => "(progn (require 'hive-mcp-magit nil t) ...)"
Elisp SOURCE construction — a pure leaf. Every fn here is a string builder: Clojure data in, elisp source text out. No editor connection, no evaluation, no state, no lifecycle. That is the whole point of the namespace existing separately. WHY A LEAF AND NOT AN ADDON CAPABILITY: a host that builds elisp needs these functions at LOAD time and in unit tests, long before (and often without) any editor addon mounting. Publishing them as a runtime capability turns a pure function into a lifecycle dependency — the mount-order race that this library exists to remove. Evaluation is a capability; syntax is not. Consumers: hive-emacs re-exports these as hive-emacs.elisp; hive-mcp reaches them directly, which is how the host stopped compile-depending on the addon for string construction. Usage: (require '[hive-elisp.core :as el]) (el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) ;; => "(progn (require 'hive-mcp-magit nil t) ...)"
(elisp-quote v)Quote a Clojure value for elisp.
Strings get double-quoted, symbols get quoted, numbers pass through,
booleans become elisp's t / nil.
Quote a Clojure value for elisp. Strings get double-quoted, symbols get quoted, numbers pass through, booleans become elisp's `t` / `nil`.
(emit form)Compile a Clojure form to elisp source via clojure-elisp when present, falling back to pr-str.
Compile a Clojure form to elisp source via clojure-elisp when present, falling back to pr-str.
(emit-forms forms)Compile multiple forms to elisp source, joined by blank lines.
Compile multiple forms to elisp source, joined by blank lines.
(fboundp-call-json fn-sym & args)Generate elisp: check if function exists, call it, JSON-encode. Use when the feature is already required elsewhere.
Generate elisp: check if function exists, call it, JSON-encode. Use when the feature is already required elsewhere.
(format-args args)Format arguments for an elisp function call, leading space included.
Empty args produce the empty string so (fn) never becomes (fn ).
Format arguments for an elisp function call, leading space included. Empty args produce the empty string so `(fn)` never becomes `(fn )`.
(format-elisp template & args)Template-format elisp source.
Example: (format-elisp "(goto-line %d)" 42)
Template-format elisp source. Example: (format-elisp "(goto-line %d)" 42)
(require-and-call feature fn-sym & args)Generate elisp: require feature, call function, error if not available.
Generate elisp: require feature, call function, error if not available.
(require-and-call-json feature fn-sym & args)Generate elisp: require feature, call function, JSON-encode result.
The most common pattern in hive tool handlers.
Examples: (require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) (require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-log 10)
Generate elisp: require feature, call function, JSON-encode result. The most common pattern in hive tool handlers. Examples: (require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) (require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-log 10)
(require-and-call-plist-json feature fn-sym params-map)Generate elisp: require feature, call function with a single plist arg, JSON-encode result.
Eliminates positional arg ordering bugs at the CLJ<->Elisp boundary. PARAMS-MAP is a Clojure map converted to an elisp plist; nil values are omitted.
Generate elisp: require feature, call function with a single plist arg, JSON-encode result. Eliminates positional arg ordering bugs at the CLJ<->Elisp boundary. PARAMS-MAP is a Clojure map converted to an elisp plist; nil values are omitted.
(require-and-call-text feature fn-sym & args)Generate elisp: require feature, call function, return as text.
Generate elisp: require feature, call function, return as text.
(wrap-progn & elisp-strs)Wrap elisp strings in a progn form.
Wrap elisp strings in a progn form.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |