* bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer
@ 2012-01-08 15:14 Toby Cubitt
2012-01-09 3:52 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Toby Cubitt @ 2012-01-08 15:14 UTC (permalink / raw
To: 10459
Emacs versions known to be affected:
------------------------------------
23.2.1, 24 (recent bzr checkout).
Steps to reproduce:
-------------------
1. Define the following function:
(defun test ()
(interactive)
(run-with-timer
2 nil
(lambda ()
(setq overlay (make-overlay 4 8))
(overlay-put overlay 'face '(background-color . "black"))
(let ((map (make-sparse-keymap)))
(overlay-put overlay 'keymap map)
(define-key map "t" (lambda () (interactive)
(message "overlay keymap binding")))))))
2. Position point somewhere between 4 and 8.
3. M-x test
4. type "t" (*without* moving point first)
Expected output:
----------------
Overlay keymap binding should display the message "overlay keymap binding".
Actual output:
--------------
Default `self-insert-command' binding inserts character "t" into the buffer.
Additional information:
-----------------------
Note that moving the point, e.g. one character to the right and then back,
in between septs 3. and 4. seems to activate the overlay keymap binding,
so that typing "t" in step 4. displays the correct message.
--
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer
2012-01-08 15:14 bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer Toby Cubitt
@ 2012-01-09 3:52 ` Stefan Monnier
2012-01-16 11:48 ` Toby Cubitt
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-01-09 3:52 UTC (permalink / raw
To: Toby Cubitt; +Cc: 10459
Yes, this is a known limitation: the set of active keymaps is computed
before waiting for the next key sequence.
You might be able to get around this problem by pushing some dummy event
(which you then bind to `ignore' in some keymap) onto
unread-command-event from your timer, just to force a refresh.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer
2012-01-09 3:52 ` Stefan Monnier
@ 2012-01-16 11:48 ` Toby Cubitt
2012-01-16 14:34 ` Stefan Monnier
2014-10-05 1:21 ` Dmitry Gutov
0 siblings, 2 replies; 5+ messages in thread
From: Toby Cubitt @ 2012-01-16 11:48 UTC (permalink / raw
To: Stefan Monnier; +Cc: 10459
On Sun, Jan 08, 2012 at 10:52:54PM -0500, Stefan Monnier wrote:
> Yes, this is a known limitation: the set of active keymaps is computed
> before waiting for the next key sequence.
>
> You might be able to get around this problem by pushing some dummy event
> (which you then bind to `ignore' in some keymap) onto
> unread-command-event from your timer, just to force a refresh.
I've tested this, and it does indeed work. Thanks Stefan.
At the moment, for the dummy event, I'm using a keyboard event for an
unlikely unicode character with every modifier set. Is there some better
choice than this?
Toby
--
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain
email: tsc25@cantab.net
web: www.dr-qubit.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer
2012-01-16 11:48 ` Toby Cubitt
@ 2012-01-16 14:34 ` Stefan Monnier
2014-10-05 1:21 ` Dmitry Gutov
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2012-01-16 14:34 UTC (permalink / raw
To: Toby Cubitt; +Cc: 10459
> I've tested this, and it does indeed work. Thanks Stefan.
Cool. It's an ugly hack, but for now it's the best I can offer ;-(
> At the moment, for the dummy event, I'm using a keyboard event for an
> unlikely unicode character with every modifier set. Is there some better
> choice than this?
Use a symbol like `toby-cubitt-dummy-event'.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer
2012-01-16 11:48 ` Toby Cubitt
2012-01-16 14:34 ` Stefan Monnier
@ 2014-10-05 1:21 ` Dmitry Gutov
1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2014-10-05 1:21 UTC (permalink / raw
To: Toby Cubitt; +Cc: 10459-done
Version: 24.4
> On Sun, Jan 08, 2012 at 10:52:54PM -0500, Stefan Monnier wrote:
>> Yes, this is a known limitation: the set of active keymaps is computed
>> before waiting for the next key sequence.
This has been fixed around the start of 24.4 development: the set of
keymaps is recomputed at the start of a key sequence.
The examples in this and merged bugs work for me now. Please feel free
to reopen if you see a case where the problem's not fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-05 1:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-08 15:14 bug#10459: Overlay keymaps ignored until point is moved when overlay is created from timer Toby Cubitt
2012-01-09 3:52 ` Stefan Monnier
2012-01-16 11:48 ` Toby Cubitt
2012-01-16 14:34 ` Stefan Monnier
2014-10-05 1:21 ` Dmitry Gutov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.