Skip to content

Instantly share code, notes, and snippets.

@Raynes Raynes/respond.clj
Created Apr 28, 2010

What would you like to do?
(defmacro defplugin [& body]
(let [cmd-list (into {} (for [[cmdkey docs words] body word words] [word {:cmdkey cmdkey :docs docs}]))]
~@(for [[cmdkey docs words & method-stuff] body]
`(defmethod respond ~cmdkey ~@method-stuff))
(let [m-name# (keyword (last (.split (str *ns*) "\\.")))]
(alter modules merge
{: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.