unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Timer out of nowhere
@ 2013-02-13 18:21 Lluís
  2013-02-13 18:34 ` Michael Markert
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lluís @ 2013-02-13 18:21 UTC (permalink / raw)
  To: emacs-devel

Every once in a while, I get this error:

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  adict-guess-dictionary-maybe(#<killed buffer>)
  apply(adict-guess-dictionary-maybe #<killed buffer>)
  byte-code("r\301\b\302H\b\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 2 0 t adict-guess-dictionary-maybe (#<killed buffer>) idle 0])

This is from [1]. The strange part is that I just killed every possible buffer
(in case it was a local timer on any of them), and `timer-list' shows absolutely
no entry with `adict-guess-dictionary-maybe'.

Any ideas on how to track this problem?


[1] http://nschum.de/src/emacs/auto-dictionary/


Thanks,
  Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



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

* Re: Timer out of nowhere
  2013-02-13 18:21 Timer out of nowhere Lluís
@ 2013-02-13 18:34 ` Michael Markert
  2013-02-13 19:43 ` Michael Heerdegen
  2013-02-13 19:53 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Markert @ 2013-02-13 18:34 UTC (permalink / raw)
  To: emacs-devel

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

On Wed, Feb 13 2013 (19:21), Lluís <xscript@gmx.net> wrote: 

> Every once in a while, I get this error:
>
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>   adict-guess-dictionary-maybe(#<killed buffer>)
>   apply(adict-guess-dictionary-maybe #<killed buffer>)
>   byte-code("r\301\b\302H\b\303H\"\210)\301\207" [timer apply 5 6] 4)
>   timer-event-handler([t 0 2 0 t adict-guess-dictionary-maybe (#<killed buffer>) idle 0])
>
> This is from [1]. The strange part is that I just killed every possible buffer
> (in case it was a local timer on any of them), and `timer-list' shows absolutely
> no entry with `adict-guess-dictionary-maybe'.
>
> Any ideas on how to track this problem?

adict uses an idle timer so look at `timer-idle-list' instead of `timer-list'.

I use this code to treat the symptom:

    (eval-after-load 'auto-dictionary
      '(add-hook 'kill-buffer-hook
                 (defun cofi/maybe-cancel-adict-timer ()
                   (when adict-timer
                     (cancel-timer adict-timer)))))

But the problem is - for me at least - a pretty new one, meaning
some change in emacs caused this (adict hasn't changed for years).

As adict itself clears the timer when `auto-dictionary-mode' is disabled
I'd guess that modes don't get disabled anymore when a buffer is killed.

emacs-version: 24.3.50.1

Michael

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: Timer out of nowhere
  2013-02-13 18:21 Timer out of nowhere Lluís
  2013-02-13 18:34 ` Michael Markert
@ 2013-02-13 19:43 ` Michael Heerdegen
  2013-02-13 20:42   ` Lluís
  2013-02-13 20:42   ` Stefan Monnier
  2013-02-13 19:53 ` Stefan Monnier
  2 siblings, 2 replies; 6+ messages in thread
From: Michael Heerdegen @ 2013-02-13 19:43 UTC (permalink / raw)
  To: emacs-devel

Lluís <xscript@gmx.net> writes:

> Every once in a while, I get this error:
>
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>   adict-guess-dictionary-maybe(#<killed buffer>)
>   apply(adict-guess-dictionary-maybe #<killed buffer>)
>   byte-code("r\301\b\302H\b\303H\"\210)\301\207" [timer apply 5 6] 4)
>   timer-event-handler([t 0 2 0 t adict-guess-dictionary-maybe
> (#<killed buffer>) idle 0])
>
> This is from [1].

Yes, I see the same since I've upgraded my emacs.

> The strange part is that I just killed every possible buffer (in case
> it was a local timer on any of them), and `timer-list' shows
> absolutely no entry with `adict-guess-dictionary-maybe'.

It's in `timer-idle-list'.

> Any ideas on how to track this problem?

It's a bug in auto-dictionary.  I guess that in prior Emacs version, the
problem was also there, but just no message was raised.

Anyway, once `auto-dictionary-mode' calls `run-with-idle-timer', the
timer stays in `timer-idle-list' even after its buffer has been killed.

I think this is not hard to fix.  The timer runs
`adict-guess-dictionary-maybe'.  This function should just check if the
BUFFER argument is `buffer-live-p'.  If it is not, it just has to cancel
`adict-timer'.


Regards,

Michael.



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

* Re: Timer out of nowhere
  2013-02-13 18:21 Timer out of nowhere Lluís
  2013-02-13 18:34 ` Michael Markert
  2013-02-13 19:43 ` Michael Heerdegen
@ 2013-02-13 19:53 ` Stefan Monnier
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-02-13 19:53 UTC (permalink / raw)
  To: emacs-devel

> Any ideas on how to track this problem?

It sounds like the timer function (adict-guess-dictionary-maybe) should
check if the buffer for which it's called still exists, and if not it
should cancel itself.


        Stefan



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

* Re: Timer out of nowhere
  2013-02-13 19:43 ` Michael Heerdegen
@ 2013-02-13 20:42   ` Lluís
  2013-02-13 20:42   ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Lluís @ 2013-02-13 20:42 UTC (permalink / raw)
  To: emacs-devel

Michael Heerdegen writes:

> Lluís <xscript@gmx.net> writes:
>> Every once in a while, I get this error:
>> 
>> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>> adict-guess-dictionary-maybe(#<killed buffer>)
>> apply(adict-guess-dictionary-maybe #<killed buffer>)
>> byte-code("r\301\b\302H\b\303H\"\210)\301\207" [timer apply 5 6] 4)
>> timer-event-handler([t 0 2 0 t adict-guess-dictionary-maybe
>> (#<killed buffer>) idle 0])
>> 
>> This is from [1].

> Yes, I see the same since I've upgraded my emacs.

>> The strange part is that I just killed every possible buffer (in case
>> it was a local timer on any of them), and `timer-list' shows
>> absolutely no entry with `adict-guess-dictionary-maybe'.

> It's in `timer-idle-list'.

Aha, I didn't look into that one, thanks.


>> Any ideas on how to track this problem?

> It's a bug in auto-dictionary.  I guess that in prior Emacs version, the
> problem was also there, but just no message was raised.

> Anyway, once `auto-dictionary-mode' calls `run-with-idle-timer', the
> timer stays in `timer-idle-list' even after its buffer has been killed.

> I think this is not hard to fix.  The timer runs
> `adict-guess-dictionary-maybe'.  This function should just check if the
> BUFFER argument is `buffer-live-p'.  If it is not, it just has to cancel
> `adict-timer'.

The timer is stored in a buffer-local variable, so it has to be removed when the
buffer is killed. In any case, I've found out that the version in github [1]
contains a fix for this, while the "official" release does not [2].

Please update your copies accordingly (I think I got mine from ELPA).


[1] https://github.com/nschum/auto-dictionary-mode
[2] http://nschum.de/src/emacs/auto-dictionary/


-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



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

* Re: Timer out of nowhere
  2013-02-13 19:43 ` Michael Heerdegen
  2013-02-13 20:42   ` Lluís
@ 2013-02-13 20:42   ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-02-13 20:42 UTC (permalink / raw)
  To: emacs-devel

> It's a bug in auto-dictionary.  I guess that in prior Emacs version, the
> problem was also there, but just no message was raised.

Ah, indeed, the timer code used to silently ignore errors, thus
sometimes hiding subtle bugs, but I've changed it in trunk.


        Stefan



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

end of thread, other threads:[~2013-02-13 20:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 18:21 Timer out of nowhere Lluís
2013-02-13 18:34 ` Michael Markert
2013-02-13 19:43 ` Michael Heerdegen
2013-02-13 20:42   ` Lluís
2013-02-13 20:42   ` Stefan Monnier
2013-02-13 19:53 ` 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).