unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Error does not throw to debugger in 'when' block
Date: Thu, 12 Jan 2023 10:08:13 +0100	[thread overview]
Message-ID: <AM9PR09MB497789B92E212B474FA162E896FD9@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <83o7r4kvgs.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 12 Jan 2023 10:28:35 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Date: Thu, 12 Jan 2023 07:51:01 +0100
>> 
>> When running this little code, I have observed that 'error' does not end in
>> debugger:
>> 
>> (defun new-patch (&optional patch-name)
>>   (interactive "sPatch name: ")
>>   (let ((path (expand-file-name patch-name)))
>>     (message "PATH: %s" path)
>>     (when (file-exists-p path)
>>       (error "A worktree with this name already exists"))))
>> 
>> If I run this code, I see it correctly executes error, but it does not open
>> debugger. If I place cursor after the error form, debugger is
>> opened. Value of debug-on-error is 't.
>> 
>> This is output in *Messages* buffer for 'Emacs -Q':
>> 
>> PATH: /home/arthur/repos/emsrc/28.2
>> progn: A worktree with this name already exists
>> Mark set [2 times]
>> 
>> Just curious, is this intended new behaviour for 'error' or a bug?
>
> How exactly do you "run this code"?  The details matter.

Just pasted the above defun in scratch buffer, in emacs with -Q option, then
C-x C-e, and run with M-x. Nothing special.

I have observed later, that it correctly exits from the execution of defun, if I
add more code after the 'when' form. It just does not end up in the debug buffer.

I am ok with the new behavior, I think it is probably more handy, was just
surprised, haven't noticed it before.

The Emacs used was built today from the lastest master, maybe a couple of hors
before I posted this message.



  reply	other threads:[~2023-01-12  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12  6:51 Error does not throw to debugger in 'when' block Arthur Miller
2023-01-12  8:28 ` Eli Zaretskii
2023-01-12  9:08   ` Arthur Miller [this message]
2023-01-12 11:26     ` Michael Heerdegen
2023-01-12 19:18       ` Arthur Miller
2023-01-12 21:15         ` Michael Heerdegen
2023-01-12 22:49           ` Arthur Miller

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=AM9PR09MB497789B92E212B474FA162E896FD9@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).