unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Oleg Sivokon <oleg.sivokon@elastifile.com>
Cc: 24959@debbugs.gnu.org
Subject: bug#24959: 26.0.50; cancel-timer: void-variable timer
Date: Thu, 17 Nov 2016 19:03:53 +0100	[thread overview]
Message-ID: <m337iqdlva.fsf@gnus.org> (raw)
In-Reply-To: <CA+-61TQ6=swFWLD7=GvSAte26nsesxcFMv_kOhAmUq8Bcd-HAQ@mail.gmail.com> (Oleg Sivokon's message of "Thu, 17 Nov 2016 20:00:27 +0200")

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	other threads:[~2016-11-17 18:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17  9:48 bug#24959: 26.0.50; cancel-timer: void-variable timer Oleg Sivokon
2016-11-17 17:08 ` Eli Zaretskii
2016-11-17 17:11 ` Lars Ingebrigtsen
2016-11-17 17:55   ` Oleg Sivokon
2016-11-17 17:56     ` Lars Ingebrigtsen
2016-11-17 18:00       ` Oleg Sivokon
2016-11-17 18:03         ` Lars Ingebrigtsen [this message]
2016-11-17 18:06           ` Oleg Sivokon
2016-11-17 18:09             ` Lars Ingebrigtsen
2016-11-17 19:14               ` Oleg Sivokon
2016-11-17 19:19                 ` Oleg Sivokon
2016-11-17 19:22                   ` Lars Ingebrigtsen
2016-11-17 19:24                     ` Oleg Sivokon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m337iqdlva.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=24959@debbugs.gnu.org \
    --cc=oleg.sivokon@elastifile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).