emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /srv/bzr/emacs/trunk r107126: Document yet more things that were nev


From: Wolfgang Jenkner
Subject: Re: /srv/bzr/emacs/trunk r107126: Document yet more things that were never added to NEWS
Date: Tue, 07 Feb 2012 20:02:12 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (berkeley-unix)

On Mon, Feb 06 2012, Stefan Monnier wrote:

>> Is there a better name for this macro _condition-case-no-debug_?
>
> Not yet.  How 'bout "condition-case-unless-debugging"?

The newly added parts in <info:(elisp) Handling Errors> mention that
with-demoted-errors is implemented in terms of condition-case-no-debug,
but this leaves me wondering why, in this or other cases, this should be
better than using condition-case with the `debug' pseudo-condition, viz.

#+begin_src emacs-lisp
(defmacro with-demoted-errors (&rest body)
  "Run BODY and demote any errors to simple messages.
If `debug-on-error' is non-nil, run BODY without catching its errors.
This is to be used around code which is not expected to signal an error
but which should be robust in the unexpected case that an error is signaled."
  (declare (debug t) (indent 0))
  (let ((err (make-symbol "err")))
    `(condition-case ,err
         (progn ,@body)
       ((debug error) (message "Error: %S" ,err) nil))))
#+end_src 

Wolfgang



reply via email to

[Prev in Thread] Current Thread [Next in Thread]