unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Lisp help: debug-on-error not effective twice?
@ 2004-04-24  7:41 Lars Brinkhoff
  2004-04-25 11:43 ` Lars Brinkhoff
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Brinkhoff @ 2004-04-24  7:41 UTC (permalink / raw)


If I run this (in *scratch*) in GNU Emacs 21.3:

    (defun my-debug (&rest args)
      (print "foo")
      (throw 'error nil))

    (let ((debug-on-error t)
          (debug-on-quit t)
          (debug-on-signal t)
          (debug-ignored-errors nil)
          (debugger 'my-debug))
      (catch 'error
        (car))
      ;;(debug)
      (print (format "debug-on-error = %s" debug-on-error))
      (catch 'error
        (car)))

I get one "foo" from my-debug, then "debug-on-error = t", and then the
error "Wrong number of arguments: #<subr car>, 0".

Why isn't my-debug called twice?

If I uncomment (debug) and enter 'c' in the debugger to contine,
my-debug does get called twice.  Is debug doing something magic?

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lisp help: debug-on-error not effective twice?
       [not found] <mailman.1357.1082792547.1061.help-gnu-emacs@gnu.org>
@ 2004-04-25  1:12 ` Jesper Harder
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Harder @ 2004-04-25  1:12 UTC (permalink / raw)


Lars Brinkhoff <lars@nocrew.org> writes:

>       (catch 'error
>         (car))
>       ;;(debug)
>       (print (format "debug-on-error = %s" debug-on-error))
>       (catch 'error
>         (car)))
>
> I get one "foo" from my-debug, then "debug-on-error = t", and then the
> error "Wrong number of arguments: #<subr car>, 0".
>
> Why isn't my-debug called twice?

I don't know.  But interestingly it works correctly in the
_interpreter_ in XEmacs (the byte-compiler doesn't compile the first
catch form correctly).

-- 
Jesper Harder                                <http://purl.org/harder/>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lisp help: debug-on-error not effective twice?
  2004-04-24  7:41 Lars Brinkhoff
@ 2004-04-25 11:43 ` Lars Brinkhoff
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Brinkhoff @ 2004-04-25 11:43 UTC (permalink / raw)


Lars Brinkhoff <lars@nocrew.org> writes:
> If I run this (in *scratch*) in GNU Emacs 21.3:
> 
>     (defun my-debug (&rest args)
>       (print "foo")
>       (throw 'error nil))
> 
>     (let ((debug-on-error t)
>           (debugger 'my-debug))
>       (catch 'error
>         (car))
>       (catch 'error
>         (car)))
> 
> I get one "foo" from my-debug and then the error "Wrong number of
> arguments: #<subr car>, 0".  Why isn't my-debug called twice?

It turns out that the debugger won't be calles unless there was an
input event in between two errors.  To work around this, I could
insert

        (incf num-nonmacro-input-events)

somewhere before the second error is signaled.  Would that have any
undesirable side effects?

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-25 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1357.1082792547.1061.help-gnu-emacs@gnu.org>
2004-04-25  1:12 ` Lisp help: debug-on-error not effective twice? Jesper Harder
2004-04-24  7:41 Lars Brinkhoff
2004-04-25 11:43 ` Lars Brinkhoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).