bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24959: 26.0.50; cancel-timer: void-variable timer


From: Oleg Sivokon
Subject: bug#24959: 26.0.50; cancel-timer: void-variable timer
Date: Thu, 17 Nov 2016 20:06:40 +0200

Lars,

No, I don't use lexical bindings in this code. But, my point is that
the behavior of setq used to be to make variable special (i.e.
universaly accessible, like global, except it can be let-bound
temporarily), which it doesn't seem to do anymore. Is this change
intentional? I still didn't go over the entire changelog, but on the
surface of it, I didn't see this mentioned.

On Thu, Nov 17, 2016 at 8:03 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> Lars,
>>
>> Simplified version looks like this:
>>
>> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))
>>
>> The version that does work looks like this:
>>
>> (let ((timer [nil]))
>>   (aset timer 0 (run-at-time 1 1 (lambda (timer) (cancel-timer (aref
>> timer 0))) timer))
>
> This will only work if you're using lexical binding -- otherwise that
> `timer' in the lambda will be unbound when the lambda is called.
>
> Is there a -*- lexical-binding: t -*- on the first line of the file in
> question?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]