emacs-devel
[Top][All Lists]
Advanced

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

Re: need for 'dynamical-let'?


From: Stephen Leake
Subject: Re: need for 'dynamical-let'?
Date: Thu, 23 Jul 2015 15:58:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Stephen Leake <address@hidden> writes:

> I'm switching on lexical-binding in some files.
>
> In several cases, the byte compiler is complaining:
>
> xgit.el:993:30:Error: add-to-list cannot use lexical var `branch-list'
>
> So I have to change code like this:
>
> (let (branch-list
>       ...)
>    (add-to-list branch-list (substring branch-entry 2) t)
>
>
> to:
>
> (defvar dvc-branch-list);; add-to-list can't use lexical var
> (let (
>       ...)
>    (add-to-list 'dvc-branch-list (substring branch-entry 2) t)
>
>
> This pollutes the global name space, and disguises the local nature of
> 'branch-list'.
>
> Can we define a macro 'dynamical-let' that would implement this
> pattern, but with hidden variables?


Also, how do I know which functions I write also can't use lexical
variables? Using 'symbol-value' would be one clue, apparently. I hope
the byte-compiler will complain?

-- 
-- Stephe



reply via email to

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