bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work


From: Naohiro Aota
Subject: bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well
Date: Thu, 23 Jul 2009 03:02:51 +0900
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

I found evaluating the following code outputs "abbbbb ...", and
M-x view-lossage after that shows "b b b b b ...".

(progn
  (keyboard-translate ?a ?b)
  (push ?a unread-command-events)
  (setq my-timer
        (run-with-idle-timer 1 t (lambda () (push ?a unread-command-events)))))

This result suggests three problems.

1. If a timer handler function uses `sit-for' (or any function push a
   key to `unread-command-events'), the key would be translated once
   more.

2. idle-timer function should run "only once for each time Emacs
   becomes idle", but it seems the above function is called so many times.

3. `view-lossage' shouldn't show such stroke: "b b b b b ...".

I don't know this is the right way, but it seems the patch below solves
all the problem above.

--8<---------------cut here---------------start------------->8---
Index: src/keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.1008
diff -c -r1.1008 keyboard.c
*** src/keyboard.c      3 Jul 2009 11:07:11 -0000       1.1008
--- src/keyboard.c      22 Jul 2009 17:20:11 -0000
***************
*** 2988,2993 ****
--- 2988,2994 ----
      {
        c = XCAR (Vunread_command_events);
        Vunread_command_events = XCDR (Vunread_command_events);
+       goto reread_for_input_method;
      }
  
    /* Read something from current KBOARD's side queue, if possible.  */
--8<---------------cut here---------------end--------------->8---


2009-07-22  Naohiro Aota  <naota@elisp.net>

        * keyboard.c (read_char): When event set by a timer, sentinel or
        filter, skip keyboard translating and key recording.

Regards,





reply via email to

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