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: Lars Ingebrigtsen
Subject: bug#24959: 26.0.50; cancel-timer: void-variable timer
Date: Thu, 17 Nov 2016 19:03:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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]