X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/lisp/blobdiff_plain/a035dd4a8175317f19a35cd04568d1655fb8d417..84f4b59f93535e938e21a083e05a49a1f20f9c26:/optparse.lisp diff --git a/optparse.lisp b/optparse.lisp index 5f28365..ff301ee 100644 --- a/optparse.lisp +++ b/optparse.lisp @@ -446,13 +446,15 @@ (defmacro defopthandler (name (var &optional (arg (gensym))) on some parameters (the ARGS) and the value of an option-argument named ARG." (let ((func (intern (format nil "OPTHANDLER/~:@(~A~)" name)))) - `(progn - (setf (get ',name 'opthandler) ',func) - (defun ,func (,var ,arg ,@args) - (with-locatives ,var - (declare (ignorable ,arg)) - ,@body)) - ',name))) + (multiple-value-bind (docs decls body) (parse-body body) + `(progn + (setf (get ',name 'opthandler) ',func) + (defun ,func (,var ,arg ,@args) + ,@docs ,@decls + (with-locatives ,var + (declare (ignorable ,arg)) + ,@body)) + ',name)))) (defun parse-c-integer (string &key radix (start 0) end) "Parse STRING, or at least the parts of it between START and END, according