From 2c13c1cd713e033763786de1ce9fc66565abb5df Mon Sep 17 00:00:00 2001 Message-Id: <2c13c1cd713e033763786de1ce9fc66565abb5df.1717443293.git.mdw@distorted.org.uk> From: Mark Wooding Date: Wed, 24 May 2006 09:12:17 +0100 Subject: [PATCH 1/1] optparse: Process docstring and declarations correctly in defopthandler. Organization: Straylight/Edgeware From: Mark Wooding Previously, the docstring got left inside the with-locatives form, which is a shame. --- optparse.lisp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 -- [mdw]