GNU bug report logs -
#3904
23.1.50; [PATCH] keyboard translating with timer doesn't work well
Previous Next
Reported by: Naohiro Aota <naota <at> elisp.net>
Date: Wed, 22 Jul 2009 18:05:05 UTC
Severity: minor
Tags: patch, wontfix
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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 <at> elisp.net>
* keyboard.c (read_char): When event set by a timer, sentinel or
filter, skip keyboard translating and key recording.
Regards,
This bug report was last modified 13 years and 314 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.