[Top][All Lists]

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

Re: eval-buffer with debug-on-error t

From: Johan Bockgård
Subject: Re: eval-buffer with debug-on-error t
Date: Sat, 09 Jul 2005 12:23:01 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

"Richard M. Stallman" <address@hidden> writes:

> Does this fix it?  (I installed a more elaborate patch.)

Well, it does make the error go away.

A problem is that `debugger-old-buffer' is not necessarily the same
buffer that was current when `eval-buffer' was called.

Example (with the patch):

Run emacs -Q

M-x toggle-debug-on-error RET

Insert this into *scratch*:

     (get-buffer-create "foo")
     (with-current-buffer "foo"
       (error "foo"))

M-x eval-buffer RET


Debugger entered--Lisp error: (error "foo")
  signal(error ("foo"))
  (save-current-buffer (set-buffer "foo") (error "foo"))
  (with-current-buffer "foo" (error "foo"))
  eval-buffer()  ; Reading at buffer position 1
This is the position in the "foo" buffer.

`eval-region' has the same problem. In fact, regardless of that
problem the feature does not seem very useful at present when it comes
to eval-region.

E.g. if you do C-x h M-x eval-region RET and there is an error you
will get a note like this in the backtrace no matter where the error

  eval-region(1 500)  ; Reading at buffer position 1

Since point doesn't move (eval-region apparently works differently
than eval-buffer in this respect) the value of point will always be at
the start or the end of the region (and these values are already
present in the backtrace).

Johan Bockgård

reply via email to

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