unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
Subject: Re: eval-buffer with debug-on-error t
Date: Sat, 09 Jul 2005 12:23:01 +0200	[thread overview]
Message-ID: <yoijeka86zy2.fsf@linus003.dd.chalmers.se> (raw)
In-Reply-To: E1Dr6q2-0007bx-3W@fencepost.gnu.org

"Richard M. Stallman" <rms@gnu.org> 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"))
  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
occurred:

  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	other threads:[~2005-07-09 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-07 13:42 eval-buffer with debug-on-error t Lennart Borgman
2005-07-09  4:21 ` Richard M. Stallman
2005-07-09 10:23   ` Johan Bockgård [this message]
2005-07-10  5:19     ` Richard M. Stallman
2005-07-09 10:41   ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yoijeka86zy2.fsf@linus003.dd.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).