master 51c21cb729f 2/2: keyboard.c (Finsert_special_event): Remove redundant test

Stefan Monnier via Mailing list for Emacs changes <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 51c21cb729f704084dfb86b27b3e586377bf49f6
Author: Stefan Monnier <[email protected]>
Commit: Stefan Monnier <[email protected]>

    keyboard.c (Finsert_special_event): Remove redundant test
    
    * src/keyboard.c (Finsert_special_event): Remove redundant test.
    (kbd_buffer_get_event): Simplify.
---
 src/keyboard.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index 4becc5cfd7a..3d18d20b56e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2909,8 +2909,12 @@ read_char (int commandflag, Lisp_Object map,
      because the recursive call of read_char in read_char_minibuf_menu_prompt
      does not pass on any keymaps.  */
 
+  /* FIXME: If the keymap is *not* a menu, this fails miserably,
+     signaling (error "Empty menu") instead!  */
   if (KEYMAPP (map) && INTERACTIVE
       && !NILP (prev_event)
+      /* FIXME: These conditions are re-tested redundantly inside
+         read_char_x_menu_prompt!  */
       && EVENT_HAS_PARAMETERS (prev_event)
       && !EQ (XCAR (prev_event), Qmenu_bar)
       && !EQ (XCAR (prev_event), Qtab_bar)
@@ -2919,6 +2923,9 @@ read_char (int commandflag, Lisp_Object map,
       && !CONSP (Vunread_command_events))
     {
       c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu);
+      /* FIXME: read_char_x_menu_prompt can sometimes do nothing and just
+         return nil, should we really stop the idle timer and jump to `exit`
+         in that case?  */
 
       /* Now that we have read an event, Emacs is not idle.  */
       if (!end_time)
@@ -4029,14 +4036,10 @@ kbd_buffer_get_event (KBOARD **kbp,
 {
   Lisp_Object obj, str;
 #ifdef HAVE_X_WINDOWS
-  bool had_pending_selection_requests;
-
-  had_pending_selection_requests = false;
+  bool had_pending_selection_requests = false;
 #endif
 #ifdef HAVE_TEXT_CONVERSION
-  bool had_pending_conversion_events;
-
-  had_pending_conversion_events = false;
+  bool had_pending_conversion_events = false;
 #endif
 
   *event_frame = NULL;
@@ -12098,14 +12101,6 @@ Only 'input_event' slots KIND and ARG are set.  */)
 {
   /* Check, that it is a special event.  */
   CHECK_CONS (event);
-  if (NILP (access_keymap
-	    (get_keymap (Vspecial_event_map, 0, 1), event, 0, 0, 1)))
-    /* FIXME: Remove this check.  Since 'special-event-map' may change
-       between now and the moment we process the event, this check is
-       unreliable, and it's redundant anyway since we check below
-       if EVENT is one of the supported ones.  */
-    signal_error ("Invalid special event kind", XCAR (event));
-
   /* Construct an input event.  */
   struct input_event ie;
   EVENT_INIT (ie);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.