extended ONCE-ONLY
[alexandria.git] / conditions.lisp
blob99d7f1af58729c0b98da9a9357b064345e38cc0e
1 (in-package :alexandria)
3 (defun required-argument (&optional name)
4 "Signals an error for a missing argument of NAME. Intended for
5 use as an initialization form for structure and class-slots, and
6 a default value for required keyword arguments."
7 (error "Required argument ~@[~S ~]missing." name))
9 (define-condition simple-style-warning (style-warning simple-warning)
10 ())
12 (defun simple-style-warning (message &rest args)
13 (warn 'simple-style-warning :format-control message :format-arguments args))
15 (defmacro ignore-some-conditions ((&rest conditions) &body body)
16 "Similar to CL:IGNORE-ERRORS but the (unevaluated) CONDITIONS
17 list determines which specific conditions are to be ignored."
18 `(handler-case
19 (progn ,@body)
20 ,@(loop for condition in conditions collect
21 `(,condition (c) (values nil c)))))