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

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

Re: keymap changes in run-with-timer


From: Lennart Borgman (gmail)
Subject: Re: keymap changes in run-with-timer
Date: Fri, 13 Apr 2007 16:35:24 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

Stefan Monnier wrote:
selecting a keymap (e.g. when changing minor-mode, creating 'keymap
overlays, setting overriding-local-map, use-local-map) in a
run-with-timer or run-with-idle-timer event doesn't take immediate
effect.

Consider the following example:
(run-with-timer 3 nil '(lambda ()
                         (let ((map (make-sparse-keymap)))
                           (define-key map "x" "y")
                           (use-local-map map))
                         (message "timer fired")))

After the message "timer fired", pressing the "x" key still inserts an
"x".  Only beginning with the second time it will insert a "y".

Indeed it does: the list of active keymaps is computed right before calling
`read', i.e. right when going idle at the end of the previous command.

It would probably be good to delay it, but this is not very high priority.
I've added it to the TODO list.


If you think it is possible to do it now it would be good. I need this for mumamo too. (Mumamo is here: http://www.emacswiki.org/cgi-bin/wiki/MuMaMo)

I have a workaround there for this. I call top-level after such changes (in this case after changing major mode in a timer).




reply via email to

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