GNU bug report logs - #3904
23.1.50; [PATCH] keyboard translating with timer doesn't work well

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3904 in the body.
You can then email your comments to 3904 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3904; Package emacs. (Wed, 22 Jul 2009 18:05:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Naohiro Aota <naota <at> elisp.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 22 Jul 2009 18:05:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Naohiro Aota <naota <at> elisp.net>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; [PATCH] keyboard translating with timer doesn't work well
Date: Thu, 23 Jul 2009 03:02:51 +0900
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,



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3904; Package emacs. (Thu, 23 Jul 2009 09:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 23 Jul 2009 09:30:04 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Naohiro Aota <naota <at> elisp.net>, 3904 <at> debbugs.gnu.org
Cc: emacs-pretest-bug <at> gnu.org
Subject: Re: bug#3904: 23.1.50;	[PATCH] keyboard translating with timer doesn't
 work well
Date: Thu, 23 Jul 2009 11:23:45 +0200
> 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



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3904; Package emacs. (Thu, 23 Jul 2009 09:30:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 23 Jul 2009 09:30:14 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Dan Nicolaescu <dann <at> ics.uci.edu> to control <at> debbugs.gnu.org. (Sun, 20 Dec 2009 15:59:02 GMT) Full text and rfc822 format available.

Added tag(s) wontfix. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 12 Jul 2011 19:59:05 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 3904 <at> debbugs.gnu.org and Naohiro Aota <naota <at> elisp.net> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 12 Jul 2011 19:59:06 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3904; Package emacs. (Tue, 12 Jul 2011 20:21:02 GMT) Full text and rfc822 format available.

Message #24 received at 3904 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Naohiro Aota <naota <at> elisp.net>, 3904 <at> debbugs.gnu.org
Subject: Re: bug#3904: 23.1.50;
	[PATCH] keyboard translating with timer doesn't work well
Date: Tue, 12 Jul 2011 21:57:42 +0200
martin rudalics <rudalics <at> 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/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.