Liking cljdoc? Tell your friends :D

hive-elisp.core

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) ...)"
raw docstring

elisp-quoteclj

(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`.
raw docstring

emitclj

(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.
raw docstring

emit-formsclj

(emit-forms forms)

Compile multiple forms to elisp source, joined by blank lines.

Compile multiple forms to elisp source, joined by blank lines.
raw docstring

fboundp-call-jsonclj

(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.
raw docstring

format-argsclj

(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 )`.
raw docstring

format-elispclj

(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)
raw docstring

require-and-callclj

(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.
raw docstring

require-and-call-jsonclj

(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)
raw docstring

require-and-call-plist-jsonclj

(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.
raw docstring

require-and-call-textclj

(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.
raw docstring

wrap-prognclj

(wrap-progn & elisp-strs)

Wrap elisp strings in a progn form.

Wrap elisp strings in a progn form.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close