Skip to content

Commit

Permalink
Add optional argument to require-defclj allowing to rename the result…
Browse files Browse the repository at this point in the history
…ing macro
  • Loading branch information
licht1stein committed Apr 29, 2024
1 parent 5d3c605 commit 1822b5d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions context-transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,21 @@ The resulting transient will be called `context-transient/NAME'"


;;;###autoload
(defun context-transient-require-defclj ()
(defun context-transient-require-defclj (&optional macro-name)
"Creates a convenience macro `defclj'.
Use it to define `'cider-interactive-eval' commands.'"
(defmacro defclj (name command &optional docstring)
"Define `cider-interactive-eval' commands.
(let* ((mname (or macro-name 'defclj)))
(defmacro ,mname (name command &optional docstring)
"Define `cider-interactive-eval' commands.
NAME - is the name of the resulting function
COMMAND - is unescaped, unquoted clojure code"
`(defun ,name ()
,docstring
(interactive)
(cider-interactive-eval
(format "%s" ',command)))))
`(defun ,name ()
,docstring
(interactive)
(cider-interactive-eval
(format "%s" ',command))))))


(provide 'context-transient)
Expand Down

0 comments on commit 1822b5d

Please sign in to comment.