[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error does not throw to debugger in 'when' block
From: |
Arthur Miller |
Subject: |
Re: Error does not throw to debugger in 'when' block |
Date: |
Thu, 12 Jan 2023 10:08:13 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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.