all messages for Emacs-related lists mirrored at yhetil.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: Eli Zaretskii <eliz@gnu.org>
Cc: mail@daniel-mendler.de, 63253@debbugs.gnu.org
Subject: bug#63253: 29.0.90; with-delayed-message fails in combination with inhibit-message
Date: Mon, 08 May 2023 11:13:37 -0400	[thread overview]
Message-ID: <jwvwn1in9tr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <837ctidgab.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 08 May 2023 17:55:08 +0300")

>> So `set-message-function` is "dangerous" because it runs ELisp code from
>> `message3` => `message3_nolog` => `set_message`.
>
> So I guess we need to have run_timers bind some variable, and then in
> set_message, if that variable is non-nil, we should avoid calling
> functions from set-message-function?

That's probably the best short-term workaround, yes.

The quick hack below seems to avoid the problem for me (at the cost of
ignoring `inhibit-message` for the `with-delayed-message`s).


        Stefan


diff --git a/src/alloc.c b/src/alloc.c
index 05a19f0b7e9..7ff2cd3b100 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -367,7 +367,7 @@ #define PUREBEG (char *) pure
 
 /* If positive, garbage collection is inhibited.  Otherwise, zero.  */
 
-static intptr_t garbage_collection_inhibited;
+intptr_t garbage_collection_inhibited;
 
 /* The GC threshold in bytes, the last time it was calculated
    from gc-cons-threshold and gc-cons-percentage.  */
diff --git a/src/xdisp.c b/src/xdisp.c
index 43847544396..a5d7d256b6d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12810,6 +12810,8 @@ truncate_message_1 (void *a1, Lisp_Object a2)
   return false;
 }
 
+extern intptr_t garbage_collection_inhibited;
+
 /* Set the current message to STRING.  */
 
 static void
@@ -12819,7 +12821,11 @@ set_message (Lisp_Object string)
 
   eassert (STRINGP (string));
 
-  if (FUNCTIONP (Vset_message_function))
+  if (FUNCTIONP (Vset_message_function)
+      /* FIXME: (bug#63253) We should really make the regexp engine re-entrant,
+         but in the mean time, let's ignore `set-message-function` when
+         called from `probably_quit`.  */
+      && !garbage_collection_inhibited)
     {
       specpdl_ref count = SPECPDL_INDEX ();
       specbind (Qinhibit_quit, Qt);






  reply	other threads:[~2023-05-08 15:13 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=jwvwn1in9tr.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63253@debbugs.gnu.org \
    --cc=eliz@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.