emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] lisp: scoping vars in repetitive defuns


From: John Kitchin
Subject: Re: [O] lisp: scoping vars in repetitive defuns
Date: Wed, 18 Sep 2019 19:17:58 -0400

I played with a similar idea of converting a plist to something you can call to access values at https://kitchingroup.cheme.cmu.edu/blog/2017/04/16/A-callable-plist-data-structure-for-Emacs/. It did end up as a macro, but no eval required. It never made it past that post, but it might have an application here. 

I am not sure why you have to loop over everything in a let statement though. you can use something like https://github.com/nicferrier/emacs-kv to get all the keys an loop over those to do what you want, or you can just use cl-loop to do that. So, unless you are defining new variables for readability you shouldn't need to let bind anything that is in the plist, only new things that are derived from it.

John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Wed, Sep 18, 2019 at 5:45 PM Adam Porter <address@hidden> wrote:
Joost Kremers <address@hidden> writes:

> On Wed, Sep 18 2019, Matt Price wrote:
>> Is thre away to do that kind of destructuring bind -- which
>> binds *everything* in the plist, without knowing the symbol names in
>> advance? that would be really great.
>
> let-alist perhaps?

Well, let-alist is for alists, not plists.  ;) But anyway, it's a macro,
and it does require knowing keys at compile time.  -let is a good
alternative for plists and other maps.



reply via email to

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