Subject: Re: bug#13999: 24.3.50; rng-validate-while-idle -> (error "Selecting deleted buffer")

From: Leo Liu <[email-masked]>
Date: Fri, 22 Mar 2013 17:55:31 +0800

On 2013-03-20 12:30 +0800, Leo Liu wrote:
>> Yes, clearly a recipe would require killing the buffer in such a way
>> that the timer is not canceled.  While we may want to try and fix the
>> hole that lets this happen, I think it's still worthwhile to defensively
>> make rng-validate-while-idle check that the buffer is still live, since
>> the other problem may be anywhere in some unrelated code (potentially
>> external to Emacs) that let-binds kill-buffer-hook (for example).
>
> I fully agree. I'll see if I can get to the root of the problem while
> the OP is finding a recipe. IOW, I'll take care of this bug.

One possibility is the buffer is killed while timer-idle-list is
temporarily bound to nil, in this case the timer will be left in the
timer-idle-list and causing this error.

The code in rng-valid.el uses the following idiom to redisplay without
triggering idle timers.

(let ((timer-idle-list nil))
   ....
   (sit-for 0)
   ....)

Is there a way to do this without let-binding timer-idle-list?

Leo