Re: keymap changes in run-with-timer

2007-04-13 Thread Stefan Monnier
 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.


Stefan


___
emacs-pretest-bug mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: keymap changes in run-with-timer

2007-04-13 Thread Lennart Borgman (gmail)

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



___
emacs-pretest-bug mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: keymap changes in run-with-timer

2007-04-13 Thread Nikolaj Schumacher

Stefan Monnier writes:

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

Thank you.

Lennart Borgman writes:

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

Thank you for pointing that out; it works well.  It is unfortunate that
it prints out Back to top level every time.  My workaround so far has
been to merge the keymap into the current map using define-key, one
entry at a time.


regards,
Nikolaj Schumacher


___
emacs-pretest-bug mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug