From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: mlang@blind.guru, emacs-devel@gnu.org
Subject: Re: Why does signaling an error not call set-message-function?
Date: Tue, 05 Apr 2022 10:19:41 -0400 [thread overview]
Message-ID: <jwvo81fty72.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <834k37ejk5.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 05 Apr 2022 16:39:06 +0300")
>> I don't see a problem running arbitrary ELisp code at that time.
>> After all, we already exited the error-signaling context
> We did?
You made me doubt, but indeed I see:
Lisp_Object
command_loop_2 (Lisp_Object handlers)
{
register Lisp_Object val;
do
val = internal_condition_case (command_loop_1, handlers, cmd_error);
while (!NILP (val));
return Qnil;
}
So `cmd_error` is run after we exit the error-signaling context.
Also while looking at it, I saw tht `cmd_error` then calls
`cmd_error_internal` which calls `command-error-function`:
command-error-function is a variable defined in ‘C source code’.
Its value is ‘help-command-error-confusable-suggestions’
Function to output error messages.
Called with three arguments:
- the error data, a list of the form (SIGNALED-CONDITION . SIGNAL-DATA)
such as what ‘condition-case’ would bind its variable to,
- the context (a string which normally goes at the start of the message),
- the Lisp function within which the error was signaled.
Also see ‘set-message-function’ (which controls how non-error messages
are displayed).
So we do already allow running arbitrary ELisp code in there ;-)
Stefan
next prev parent reply other threads:[~2022-04-05 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 8:01 Why does signaling an error not call set-message-function? Mario Lang
2022-04-05 11:38 ` Eli Zaretskii
2022-04-05 12:05 ` Mario Lang
2022-04-05 12:21 ` Eli Zaretskii
2022-04-05 12:55 ` Mario Lang
2022-04-05 13:58 ` T.V Raman
2022-04-05 13:14 ` Stefan Monnier
2022-04-05 13:20 ` Eli Zaretskii
2022-04-05 13:34 ` Stefan Monnier
2022-04-05 13:39 ` Eli Zaretskii
2022-04-05 14:19 ` Stefan Monnier [this message]
2022-04-05 16:07 ` T.V Raman
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=jwvo81fty72.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=mlang@blind.guru \
/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).