emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The order input events are processed.


From: Michaël Cadilhac
Subject: The order input events are processed.
Date: Thu, 07 Sep 2006 13:21:18 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Try the following:

(setq unread-post-input-method-events '(?a ?b ?c))
(sit-for 0.1)

 (Note: This is not a test for the test, this is an actual problem
  with input methods and sit-for)

It will result in the unexpected behavior that events are processed as
« bca ».  IIUC, this is how it happens :

- Sit-for takes the `a' with its `read-event'
- Sit-for stores it back in `unread-command-events' _and it seems normal_:
  I think that users are expected to use that var, especially because
  the docstring says this is the FIRST input var processed.
- read_char is made three times: for the two first times it will take
  events from post-input, then for the third, from
  unread-command-events, because post-input is processed BEFORE
  unread-command-events. 

I think Handa's changes 2006-08-21 (fixing the docstring of post-input
that indicated that it was processed AFTER unread-command-events,
whilst it was the contrary) wasn't the good one.

I propose to revert the docstring and make the code respect both this
one and unread-command-events' one.

Index: src/keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.874
diff -c -r1.874 keyboard.c
*** src/keyboard.c      27 Aug 2006 07:09:06 -0000      1.874
--- src/keyboard.c      7 Sep 2006 11:19:24 -0000
***************
*** 2504,2526 ****
   retry:
  
    reread = 0;
-   if (CONSP (Vunread_post_input_method_events))
-     {
-       c = XCAR (Vunread_post_input_method_events);
-       Vunread_post_input_method_events
-       = XCDR (Vunread_post_input_method_events);
- 
-       /* Undo what read_char_x_menu_prompt did when it unread
-        additional keys returned by Fx_popup_menu.  */
-       if (CONSP (c)
-         && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
-         && NILP (XCDR (c)))
-       c = XCAR (c);
- 
-       reread = 1;
-       goto reread_first;
-     }
- 
    if (unread_command_char != -1)
      {
        XSETINT (c, unread_command_char);
--- 2504,2509 ----
***************
*** 2552,2557 ****
--- 2535,2557 ----
        goto reread_for_input_method;
      }
  
+   if (CONSP (Vunread_post_input_method_events))
+     {
+       c = XCAR (Vunread_post_input_method_events);
+       Vunread_post_input_method_events
+       = XCDR (Vunread_post_input_method_events);
+ 
+       /* Undo what read_char_x_menu_prompt did when it unread
+        additional keys returned by Fx_popup_menu.  */
+       if (CONSP (c)
+         && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
+         && NILP (XCDR (c)))
+       c = XCAR (c);
+ 
+       reread = 1;
+       goto reread_first;
+     }
+ 
    if (CONSP (Vunread_input_method_events))
      {
        c = XCAR (Vunread_input_method_events);
***************
*** 11218,11225 ****
  
    DEFVAR_LISP ("unread-post-input-method-events", 
&Vunread_post_input_method_events,
               doc: /* List of events to be processed as input by input methods.
! These events are processed before `unread-command-events'
! and actual keyboard input without given to `input-method-function'.  */);
    Vunread_post_input_method_events = Qnil;
  
    DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events,
--- 11218,11225 ----
  
    DEFVAR_LISP ("unread-post-input-method-events", 
&Vunread_post_input_method_events,
               doc: /* List of events to be processed as input by input methods.
! These events are processed after `unread-command-events', but
! before actual keyboard input without given to `input-method-function'.  */);
    Vunread_post_input_method_events = Qnil;
  
    DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events,
Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.5270
diff -c -0 -r1.5270 ChangeLog
*** src/ChangeLog       6 Sep 2006 17:53:59 -0000       1.5270
--- src/ChangeLog       7 Sep 2006 11:19:34 -0000
***************
*** 0 ****
--- 1,6 ----
+ 2006-09-07  Michaël Cadilhac  <address@hidden>
+ 
+       * keyboard.c (read_char): Read Vunread_post_input_method_events
+       after Vunread_command_events.
+       (syms_of_keyboard): Document it in `unread-post-input-method-events'.
+ 
Regards

-- 
 |      Michaël `Micha' Cadilhac   |  Pour les 35-40 ans, l'humour          |
 |         Epita/LRDE Promo 2007   |       c'est une plus-value.            |
 | http://www.lrde.org/~cadilh_m   |          -- Guillaume L.               |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpCzO0oFSbvq.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]