unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: 63253@debbugs.gnu.org
Subject: bug#63253: 29.0.90; with-delayed-message fails in combination with inhibit-message
Date: Mon, 08 May 2023 09:54:35 -0400	[thread overview]
Message-ID: <jwvpm7bnf0q.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87r0rxdwc8.fsf@daniel-mendler.de> (Daniel Mendler's message of "Wed, 03 May 2023 21:54:47 +0200")

> There seems to exist an interaction issue of `with-delayed-message' with
> `inhibit-message'.

Very much so, indeed.  The issue is fundamentally linked to
`set-message-function`:

`with-delayed-message` calls `message3` (via
`with_delayed_message_display`) from an "atimer", i.e. a thing that can
be run from `process_pending_signals`, `unblock_input`, `maybe_quit`, ...

AFAIK these are places where it's safe to run some C code, but not
places where it's safe to run arbitrary ELisp code.

So `set-message-function` is "dangerous" because it runs ELisp code from
`message3` => `message3_nolog` => `set_message`.

I think this is related to bug#58042.

Here the problem is that the regexp engine is stateful, so calling
a regexp function in the middle of another regexp match causes serious
problems.  When we need to run ELisp from a regexp match for
on-the-fly syntax-propertization (in `parse_sexp_propertize`), we're
careful to try and detect if the ELisp code may have modified the
current buffer and we re-set the `gl_state` with a call to
`SETUP_SYNTAX_TABLE`.

But when `with-delayed-message' performs a regexp operation from within
another regexp match, it doesn't re-set the `gl_state`, which then leads
to this "Error in syntax_table logic for to-the-end intervals" error.

I'm surprised we haven't yet seen the same problem when the ELisp code is
run via things like -[EmacsView layoutSublayersOfLayer:] which can be
called from `maybe_quit` and call `redisplay` which in turn can run
arbitrary ELisp code (via `mode-line-format`, jit-lock, you name it).


        Stefan






  parent reply	other threads:[~2023-05-08 13:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 19:54 bug#63253: 29.0.90; with-delayed-message fails in combination with inhibit-message Daniel Mendler
2023-05-04  5:21 ` Eli Zaretskii
2023-05-04 22:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 13:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-08 14:55   ` Eli Zaretskii
2023-05-08 15:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 16:06       ` Eli Zaretskii
2023-05-10  2:31         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10 11:16           ` Eli Zaretskii
2023-05-10 15:15             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10 15:50               ` Eli Zaretskii
2023-05-11 15:00                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-11 15:55                   ` Eli Zaretskii
2023-05-08 15:18     ` Eli Zaretskii
2023-05-08 15:27       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=jwvpm7bnf0q.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63253@debbugs.gnu.org \
    --cc=mail@daniel-mendler.de \
    --cc=monnier@iro.umontreal.ca \
    /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).