emacs-devel
[Top][All Lists]
Advanced

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

need for 'dynamical-let'?


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

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?

-- 
-- Stephe



reply via email to

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