unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
@ 2012-03-25 14:32 Leo
  2012-03-25 18:28 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2012-03-25 14:32 UTC (permalink / raw)
  To: 11088

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

1. emacs -q -l t.el
2. C-c w
3. let emacs idle for more than 2 seconds
4. type `l'

You should still see the message "hello world" printed, which is odd
since I expect the minor mode turned off by now.


[-- Attachment #2: t.el --]
[-- Type: application/emacs-lisp, Size: 302 bytes --]

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

* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
  2012-03-25 14:32 bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer Leo
@ 2012-03-25 18:28 ` Stefan Monnier
  2012-03-26 11:31   ` Leo
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-03-25 18:28 UTC (permalink / raw)
  To: Leo; +Cc: 11088

> 1. emacs -q -l t.el
> 2. C-c w
> 3. let emacs idle for more than 2 seconds
> 4. type `l'

> You should still see the message "hello world" printed, which is odd
> since I expect the minor mode turned off by now.

> (defvar test-mode-map
>   (let ((map (make-sparse-keymap)))
>     (define-key map "l" (lambda () (interactive) (message "Hello World")))
>     map))

> (define-minor-mode test-mode ""
>   :global t
>   (if test-mode
>       (run-with-idle-timer 2 nil 'test-mode -1)))

> (global-set-key "\C-cw" 'test-mode)

It's a known problem: the set of active keymaps is computed before Emacs
starts waiting for the next key-sequence and is not recomputed after
running idle timers and process filters.


        Stefan





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

* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
  2012-03-25 18:28 ` Stefan Monnier
@ 2012-03-26 11:31   ` Leo
  2012-03-26 18:03     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2012-03-26 11:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11088

On 2012-03-26 02:28 +0800, Stefan Monnier wrote:
> It's a known problem: the set of active keymaps is computed before Emacs
> starts waiting for the next key-sequence and is not recomputed after
> running idle timers and process filters.

Stefan,

Could you document this limitation in run-with-timer or
run-with-idle-timer? I could do it but I might not understand the
problem well. Thanks.

Leo





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

* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
  2012-03-26 11:31   ` Leo
@ 2012-03-26 18:03     ` Stefan Monnier
  2012-03-27  1:21       ` Leo
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-03-26 18:03 UTC (permalink / raw)
  To: Leo; +Cc: 11088

>> It's a known problem: the set of active keymaps is computed before Emacs
>> starts waiting for the next key-sequence and is not recomputed after
>> running idle timers and process filters.

> Could you document this limitation in run-with-timer or
> run-with-idle-timer?  I could do it but I might not understand the
> problem well. Thanks.

I don't think it's worth the trouble to try and document the problem
everywhere where it might appear (timers, process filters, process
sentinels, or any code run by them such as font-lock code, ...).

Better would be to fix it (basically, delay the initialization of
nmaps/submaps/defs in keyboard.c:read_key_sequence to after we did the
first "read_char").


        Stefan





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

* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
  2012-03-26 18:03     ` Stefan Monnier
@ 2012-03-27  1:21       ` Leo
  2012-03-27  3:09         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2012-03-27  1:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11088

On 2012-03-27 02:03 +0800, Stefan Monnier wrote:
> I don't think it's worth the trouble to try and document the problem
> everywhere where it might appear (timers, process filters, process
> sentinels, or any code run by them such as font-lock code, ...).
>
> Better would be to fix it (basically, delay the initialization of
> nmaps/submaps/defs in keyboard.c:read_key_sequence to after we did the
> first "read_char").

Is there a plan to fix it? If so wonderful. I am in the impression there
isn't thus the suggestion.

Leo





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

* bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer
  2012-03-27  1:21       ` Leo
@ 2012-03-27  3:09         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2012-03-27  3:09 UTC (permalink / raw)
  To: Leo; +Cc: 11088

>> Better would be to fix it (basically, delay the initialization of
>> nmaps/submaps/defs in keyboard.c:read_key_sequence to after we did the
>> first "read_char").
> Is there a plan to fix it?

Thank you so much for volunteering.
Looking forward to your patch,


        Stefan ;-)





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

end of thread, other threads:[~2012-03-27  3:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-25 14:32 bug#11088: 24.0.94; minor mode cannot be cleanly turned off in idle timer Leo
2012-03-25 18:28 ` Stefan Monnier
2012-03-26 11:31   ` Leo
2012-03-26 18:03     ` Stefan Monnier
2012-03-27  1:21       ` Leo
2012-03-27  3:09         ` Stefan Monnier

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