all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: pm@a16n.net, larsi@gnus.org, 49997@debbugs.gnu.org
Subject: bug#49997: 27.2; idle-time reset when switching desktop-page
Date: Sun, 22 Aug 2021 10:24:15 +0200	[thread overview]
Message-ID: <e94b11f4-722c-2b16-ee9d-5fcbc2763186@gmx.at> (raw)
In-Reply-To: <83eeao1jmt.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

 > If we end up with a list of ignored events, as I think we should, we
 > should consider making the same list control all of the relevant
 > features.

Not sure whether the attached is what you meant - it's just a first stab
in that direction.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: while-no-input-ignore-events.diff --]
[-- Type: text/x-patch; name="while-no-input-ignore-events.diff", Size: 2907 bytes --]

diff --git a/lisp/subr.el b/lisp/subr.el
index 0a31ef2b29..f100259e9e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4350,11 +4350,6 @@ with-local-quit
 	   ;; that intends to handle the quit signal next time.
 	   (eval '(ignore nil)))))

-;; Don't throw `throw-on-input' on those events by default.
-(setq while-no-input-ignore-events
-      '(focus-in focus-out help-echo iconify-frame
-        make-frame-visible selection-request))
-
 (defmacro while-no-input (&rest body)
   "Execute BODY only as long as there's no pending input.
 If input arrives, that ends the execution of BODY,
diff --git a/src/keyboard.c b/src/keyboard.c
index 2e4c4e6aab..48b9904d85 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2927,20 +2927,8 @@ read_char (int commandflag, Lisp_Object map,
       last_input_event = c;
       call4 (Qcommand_execute, tem, Qnil, Fvector (1, &last_input_event), Qt);

-      if (CONSP (c)
-          && (EQ (XCAR (c), Qselect_window)
-              || EQ (XCAR (c), Qfocus_out)
-#ifdef HAVE_DBUS
-	      || EQ (XCAR (c), Qdbus_event)
-#endif
-#ifdef USE_FILE_NOTIFY
-	      || EQ (XCAR (c), Qfile_notify)
-#endif
-#ifdef THREADS_ENABLED
-	      || EQ (XCAR (c), Qthread_event)
-#endif
-	      || EQ (XCAR (c), Qconfig_changed_event))
-          && !end_time)
+      if (CONSP (c) && !NILP (Fmemq (XCAR (c), Vwhile_no_input_ignore_events))
+	  && !end_time)
 	/* We stopped being idle for this event; undo that.  This
 	   prevents automatic window selection (under
 	   mouse-autoselect-window) from acting as a real input event, for
@@ -11550,6 +11538,27 @@ init_keyboard (void)
   {SYMBOL_INDEX (Qselect_window),       SYMBOL_INDEX (Qswitch_frame)}
 };

+static Lisp_Object
+init_while_no_input_ignore_events (void)
+{
+  Lisp_Object events = listn (9, Qselect_window, Qhelp_echo, Qmove_frame,
+			      Qiconify_frame, Qmake_frame_visible,
+			      Qfocus_in, Qfocus_out, Qconfig_changed_event,
+			      Qselection_request);
+
+#ifdef HAVE_DBUS
+  events = Fcons (Qdbus_event, events);
+#endif
+#ifdef USE_FILE_NOTIFY
+  events = Fcons (Qfile_notify, events);
+#endif
+#ifdef THREADS_ENABLED
+  events = Fcons (Qthread_event, events);
+#endif
+
+  return events;
+}
+
 static void syms_of_keyboard_for_pdumper (void);

 void
@@ -12444,7 +12453,12 @@ syms_of_keyboard (void)

   DEFVAR_LISP ("while-no-input-ignore-events",
                Vwhile_no_input_ignore_events,
-               doc: /* Ignored events from while-no-input.  */);
+               doc: /* Ignored events from while-no-input.
+Events in this list do not count as pending input while running
+`while-no-input' and do not cause any idle timers to get reset when they
+occur.  */);
+
+  Vwhile_no_input_ignore_events = init_while_no_input_ignore_events ();

   pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
 }

  reply	other threads:[~2021-08-22  8:24 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  8:42 bug#49997: 27.2; idle-time reset when switching desktop-page Peter Münster
2021-08-11 11:32 ` Lars Ingebrigtsen
2021-08-11 12:00 ` Eli Zaretskii
2021-08-15 14:18   ` Lars Ingebrigtsen
2021-08-15 14:29     ` Eli Zaretskii
2021-08-15 14:36       ` Lars Ingebrigtsen
2021-08-15 14:44         ` Eli Zaretskii
2021-08-15 14:59           ` Lars Ingebrigtsen
2021-08-15 16:17           ` Lars Ingebrigtsen
2021-08-15 16:46             ` Eli Zaretskii
2021-08-15 16:49               ` Eli Zaretskii
2021-08-15 17:12                 ` Lars Ingebrigtsen
2021-08-15 17:39                   ` Eli Zaretskii
2021-08-15 16:54             ` Eli Zaretskii
2021-08-15 17:03               ` Eli Zaretskii
2021-08-15 17:09               ` Lars Ingebrigtsen
2021-08-18  8:02         ` martin rudalics
2021-08-18  9:16           ` Peter Münster
2021-08-18 11:36             ` Eli Zaretskii
2021-08-18 14:36               ` Lars Ingebrigtsen
2021-08-20  8:19               ` martin rudalics
2021-08-20 10:43                 ` Eli Zaretskii
2021-08-22  8:24                   ` martin rudalics [this message]
2021-08-22  9:33                     ` Eli Zaretskii
2021-08-22 21:41                       ` Lars Ingebrigtsen
2021-10-11  9:40                         ` Lars Ingebrigtsen
2021-10-11 11:11                           ` martin rudalics
2021-10-11 11:20                             ` Lars Ingebrigtsen
2021-10-12  8:11                               ` martin rudalics
2021-10-11 11:33                             ` Peter Münster
2021-10-12  8:11                               ` martin rudalics
2021-08-15 20:02 ` Peter Münster
2021-08-15 20:16   ` Lars Ingebrigtsen
2021-08-16  7:22     ` Peter Münster
2021-08-16 11:43       ` Lars Ingebrigtsen
2021-08-16 11:54       ` Eli Zaretskii
2021-08-16 15:51         ` Peter Münster
2021-08-16 15:55           ` Eli Zaretskii
2021-08-16 16:42             ` Peter Münster
2021-08-16 16:49               ` Eli Zaretskii
2021-08-16 17:10                 ` Peter Münster
2021-08-16 17:21                   ` Eli Zaretskii
2021-08-16 17:47                     ` Peter Münster
2021-08-16 18:08                       ` Eli Zaretskii
2021-08-16 19:54                         ` Peter Münster

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=e94b11f4-722c-2b16-ee9d-5fcbc2763186@gmx.at \
    --to=rudalics@gmx.at \
    --cc=49997@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=pm@a16n.net \
    /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.