Elisp generation helpers for hive-mcp.
This namespace provides string-based helpers for generating elisp code, with optional clojure-elisp integration for more advanced use cases.
The string helpers are stable and don't require clojure-elisp to be mature. As clojure-elisp matures, more features can be migrated to use it.
Usage: (require '[hive-emacs.elisp :as el])
;; String-based helpers (stable, recommended) (el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) ;; => "(progn (require 'hive-mcp-magit nil t) ...)"
(el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-log 10) ;; => "(progn ... (json-encode (hive-mcp-magit-api-log 10)) ...)"
;; clojure-elisp integration (experimental) (el/emit '(if (> x 0) "yes" "no"))
Elisp generation helpers for hive-mcp. This namespace provides string-based helpers for generating elisp code, with optional clojure-elisp integration for more advanced use cases. The string helpers are stable and don't require clojure-elisp to be mature. As clojure-elisp matures, more features can be migrated to use it. Usage: (require '[hive-emacs.elisp :as el]) ;; String-based helpers (stable, recommended) (el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-status) ;; => "(progn (require 'hive-mcp-magit nil t) ...)" (el/require-and-call-json 'hive-mcp-magit 'hive-mcp-magit-api-log 10) ;; => "(progn ... (json-encode (hive-mcp-magit-api-log 10)) ...)" ;; clojure-elisp integration (experimental) (el/emit '(if (> x 0) "yes" "no"))
(emit form)Compile a Clojure form to elisp string using clojure-elisp.
Falls back to pr-str if clojure-elisp is not available.
Example: (emit '(buffer-name)) => "(buffer-name)" (emit '(if (> x 0) "yes" "no"))
Compile a Clojure form to elisp string using clojure-elisp. Falls back to pr-str if clojure-elisp is not available. Example: (emit '(buffer-name)) => "(buffer-name)" (emit '(if (> x 0) "yes" "no"))
(emit-forms forms)Compile multiple forms to elisp, joined by newlines.
Compile multiple forms to elisp, joined by newlines.
(fboundp-call-json fn-sym & args)Generate elisp: check if function exists, call it, JSON-encode.
Use when feature is already required elsewhere.
Example: (fboundp-call-json 'hive-mcp-api-status)
Generate elisp: check if function exists, call it, JSON-encode. Use when feature is already required elsewhere. Example: (fboundp-call-json 'hive-mcp-api-status)
(format-elisp template & args)Simple elisp template formatting.
Example: (format-elisp "(goto-line %d)" 42) (format-elisp "(switch-to-buffer %s)" (pr-str buffer-name))
Simple elisp template formatting. Example: (format-elisp "(goto-line %d)" 42) (format-elisp "(switch-to-buffer %s)" (pr-str buffer-name))
(require-and-call feature fn-sym & args)Generate elisp: require feature, call function, error if not available.
Examples: (require-and-call 'hive-mcp-magit 'hive-mcp-magit-api-stage files)
Generate elisp: require feature, call function, error if not available. Examples: (require-and-call 'hive-mcp-magit 'hive-mcp-magit-api-stage files)
(require-and-call-json feature fn-sym & args)Generate elisp: require feature, call function, JSON-encode result.
This is the most common pattern in hive-mcp 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-json 'hive-mcp-cider 'hive-mcp-cider-eval code-str)
Generate elisp: require feature, call function, JSON-encode result. This is the most common pattern in hive-mcp 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-json 'hive-mcp-cider 'hive-mcp-cider-eval code-str)
(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.
Examples: (require-and-call-plist-json 'hive-mcp-cider 'hive-mcp-cider-spawn-session-from-plist {:name "foo" :repl-type 'clj :project-dir "/path"}) ;; => (progn ... (hive-mcp-cider-spawn-session-from-plist (list :name "foo" :repl-type 'clj :project-dir "/path")))
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.
Examples:
(require-and-call-plist-json 'hive-mcp-cider 'hive-mcp-cider-spawn-session-from-plist
{:name "foo" :repl-type 'clj :project-dir "/path"})
;; => (progn ... (hive-mcp-cider-spawn-session-from-plist (list :name "foo" :repl-type 'clj :project-dir "/path")))(require-and-call-text feature fn-sym & args)Generate elisp: require feature, call function, return as text.
Similar to require-and-call-json but returns plain text.
Examples: (require-and-call-text 'hive-mcp-magit 'hive-mcp-magit-api-diff 'staged)
Generate elisp: require feature, call function, return as text. Similar to require-and-call-json but returns plain text. Examples: (require-and-call-text 'hive-mcp-magit 'hive-mcp-magit-api-diff 'staged)
(wrap-progn & elisp-strs)Wrap multiple elisp strings in a progn form.
Wrap multiple 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 |