GNU bug report logs - #15139
24.3; Error in section 11.9.3 of the Elisp Reference Manual

Previous Next

Package: emacs;

Reported by: Sian Mountbatten <poenikatu <at> fastmail.co.uk>

Date: Tue, 20 Aug 2013 08:56:01 UTC

Severity: minor

Tags: notabug

Found in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#15139: 24.3;
 Error in section 11.9.3 of the Elisp Reference Manual
Date: Tue, 20 Aug 2013 13:08:31 +0200
Sian Mountbatten <poenikatu <at> fastmail.co.uk> writes:

> In section 11.9.3 Lexical Binding of the Elisp Reference Manual, the
> following forms are given:
>
> (defvar my-ticker nil)  ; comment
>
> (let ((x 0))
>      (setq my-ticker (lambda ()
>                        (setq x (1+ x)))))
>
> (funcall my-ticker)
>
> The manual says that the 3rd form (funcall...) yields `1'. When these
> forms are evaluated using C-xC-e, the 3rd form enters the debugger with
> the error `void variable x'.

The manual is speaking of lexical binding, try this or use the code
above in a lexical-binding environment:

(defvar my-ticker nil)  ; comment

(lexical-let ((x 0))
  (setq my-ticker (lambda ()
                    (setq x (1+ x)))))

(funcall my-ticker)

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





This bug report was last modified 11 years and 272 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.