[Openmcl-devel] documentation from the string to the error print
Janusz Podrazik
info at mracpublishing.com
Tue Jun 21 09:02:06 PDT 2011
What I am trying to do is to include function documentation from the string to the error print.
(defMacro do-quietly (&body body)
`(let ((temp diagnose-verbose)
(return-value nil))
(handler-case
(progn
(setq diagnose-verbose nil)
(setq return-value (progn , at body))
(setq diagnose-verbose temp)
return-value)
(error (c)
(princ "ERROR! Check Arguments.")
(print c)
(setq diagnose-verbose temp)
(abort)))))
(collect-sum '(a b c)
3 > ERROR! Check Arguments.
#<type-error #x3020035FF37D>
Now with (documentation function-name 'function)
(defMacro do-quietly (name &body body) ; with name
`(let ((temp diagnose-verbose)
(return-value nil))
(handler-case
(progn
(setq diagnose-verbose nil)
(setq return-value (progn , at body))
(setq diagnose-verbose temp)
return-value)
(error (c)
(princ "ERROR! Check Arguments.")
(princ (documentation name 'function))
(print c)
(setq diagnose-verbose temp)
(abort)))))
(defun collect-sum (n)
"COLLECT-SUM (numbers)
Returns the sum of the elements in a series of numbers.
Examples:
(collect-sum '(1 2 3 4)
(collect-sum '(1 2 3 -4))"
(do-quietly 'collect-sum ;function name
(reduce #'+ n)))
4 > ERROR! Check Arguments.
> Error: Unbound variable: name
> While executing: collect-sum, in process Listener(13).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.
what I am looking for is:
(collect-sum '( a b c)
3 > ERROR! Check Arguments.
"COLLECT-SUM (numbers)
Returns the sum of the elements in a series of numbers.
Examples:
(collect-sum '(1 2 3 4))
(collect-sum '(1 2 3 -4))
"
#<type-error #x3020035FF37D>
whats wrong?
regards,
J--
MRAC Publishing
Janusz Podrazik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20110621/36a81c40/attachment.htm>
More information about the Openmcl-devel
mailing list