User Tools


Restart MUFFLE-WARNING

Data Arguments Required

None.

Description

This restart is established by warn so that handlers of warning conditions have a way to tell warn that a warning has already been dealt with and that no further action is warranted.

Examples

(defvar *all-quiet* nil)

*ALL-QUIET*

(defvar *saved-warnings* '())

*SAVED-WARNINGS*

(defun quiet-warning-handler (c) (when *all-quiet* (let ((r (find-restart 'muffle-warning c))) (when r (push c *saved-warnings*) (defmacro with-quiet-warnings (&body forms) `(let ((*all-quiet* t) (*saved-warnings* '())) (handler-bind ((warning #'quiet-warning-handler)) ,@forms *saved-warnings*)))

WITH-QUIET-WARNINGS

(defparameter *saved* (with-quiet-warnings (warn "Situation #1.") (let ((*all-quiet* nil)) (warn "Situation #2.")) (warn "Situation #3.")))

Warning: Situation #2.

*SAVED*

*saved*

(#<SIMPLE-WARNING 42744421> #<SIMPLE-WARNING 42744365>)

(dolist (s *saved*) (format t "~&~A~%" s))

Situation #3. Situation #1.

NIL

See Also

\secref\Restarts, {\secref\InterfacesToRestarts}, Function INVOKE-RESTART, Function MUFFLE-WARNING, Function WARN