Skip to content

Instantly share code, notes, and snippets.

@cgrand cgrand/respond.clj forked from Raynes/respond.clj
Created Apr 28, 2010

Embed
What would you like to do?
;; something like that should be closer to what you want
(defmacro defplugin [& body]
(let [cmd-list (into {} (for [[docs words cmdkey] body word words] [word {:cmd cmdkey :doc docs}]))]
`(do
~@(for [[docs words cmdkey & method-stuff] body]
`(defmethod respond ~cmdkey ~@method-stuff))
(dosync
(let [m-name# (keyword (last (.split (str *ns*) "\\.")))]
(alter modules assoc m-name#
{:load #(dosync (alter commands assoc m-name# ~cmd-list))
:unload #(dosync (alter commands dissoc m-name#))}))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.