unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well
@ 2009-07-22 18:02 Naohiro Aota
  2009-07-23  9:23 ` martin rudalics
  0 siblings, 1 reply; 3+ messages in thread
From: Naohiro Aota @ 2009-07-22 18:02 UTC (permalink / raw)
  To: emacs-pretest-bug

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,





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

* bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well
  2009-07-22 18:02 bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well Naohiro Aota
@ 2009-07-23  9:23 ` martin rudalics
  2011-07-12 19:57   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: martin rudalics @ 2009-07-23  9:23 UTC (permalink / raw)
  To: Naohiro Aota, 3904; +Cc: emacs-pretest-bug

 > 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.

 From the Elisp manual:

    Timer functions should also avoid calling functions that cause Emacs
to wait, such as `sit-for' ...

martin





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

* bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well
  2009-07-23  9:23 ` martin rudalics
@ 2011-07-12 19:57   ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-12 19:57 UTC (permalink / raw)
  To: martin rudalics; +Cc: Naohiro Aota, 3904

martin rudalics <rudalics@gmx.at> writes:

>> 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.
>
> From the Elisp manual:
>
>    Timer functions should also avoid calling functions that cause Emacs
> to wait, such as `sit-for' ...

Yes, I don't think this is supported, so I'm closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

end of thread, other threads:[~2011-07-12 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-22 18:02 bug#3904: 23.1.50; [PATCH] keyboard translating with timer doesn't work well Naohiro Aota
2009-07-23  9:23 ` martin rudalics
2011-07-12 19:57   ` Lars Magne Ingebrigtsen

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).