GNU bug report logs - #63253
29.0.90; with-delayed-message fails in combination with inhibit-message

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Wed, 3 May 2023 19:56:02 UTC

Severity: normal

Found in version 29.0.90

Done: Daniel Mendler <mail <at> daniel-mendler.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mail <at> daniel-mendler.de, 63253 <at> 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
>> 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);





This bug report was last modified 174 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.