Subject: bug#9329: 24.0.50; `condition-case' with (debug...) is broken

From: "Drew Adams" <[email-masked]>
Date: Fri, 19 Aug 2011 06:18:16 -0700

> > (let ((debug-on-error  t)
> >       (eval-expression-debug-on-error  t))
> >   (condition-case nil (/ 1 0)
> >     ((debug error) "Test")))
> >
> > The debugger is not opened.  In Emacs 23.3 it is opened (as 
> > the doc says it should be).
> 
> The car of a handler may be a list of condition names
> instead of a single condition name.  Then it handles all of them.

Yes. So? (debug error) is a list of condition names.  It is the car of a handler
(the only handler).

> So it seems to be doing what it's supposed to be doing.

No.  Check the doc.  Check Emacs 23 - e.g., 23.3.1.

> Is this what you wanted to say instead?
> (condition-case error
>     (/ 1 0)
>   (error (debug error) "Test"))

No.

C-h i, Elisp, g handling errors

"If an error is handled by some `condition-case' form, this
ordinarily prevents the debugger from being run, even if
`debug-on-error' says this error should invoke the debugger.

If you want to be able to debug errors that are caught by a
`condition-case', set the variable `debug-on-signal' to a non-`nil'
value.  You can also specify that a particular handler should let the
debugger run first, by writing `debug' among the conditions, like this:

     (condition-case nil
         (delete-file filename)
       ((debug error) nil))
"

Put the cursor after that sexp.  `C-x C-e'.  Do the same thing in Emacs 23.