unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* The order input events are processed.
@ 2006-09-07 11:21 Michaël Cadilhac
  2006-09-09 20:45 ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Michaël Cadilhac @ 2006-09-07 11:21 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 1087 bytes --]


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.


[-- Attachment #1.1.2: keyboard.patch --]
[-- Type: text/x-patch, Size: 3226 bytes --]

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  <michael.cadilhac@lrde.org>
+ 
+ 	* 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'.
+ 

[-- Attachment #1.1.3: Type: text/plain, Size: 334 bytes --]


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: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-09-11 14:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-07 11:21 The order input events are processed Michaël Cadilhac
2006-09-09 20:45 ` Richard Stallman
2006-09-10  9:08   ` Michaël Cadilhac
2006-09-10 13:05     ` Richard Stallman
2006-09-10 13:14       ` Michaël Cadilhac
2006-09-10 21:28         ` Kim F. Storm
2006-09-11 14:12           ` Richard Stallman
2006-09-11 14:17             ` Kim F. Storm
2006-09-11 14:11         ` Richard Stallman
2006-09-11 14:19           ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).