help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: plist-put: destructive?


From: Philipp Stephani
Subject: Re: plist-put: destructive?
Date: Sun, 22 Jan 2017 10:08:18 +0000

Eric Abrahamsen <eric@ericabrahamsen.net> schrieb am So., 22. Jan. 2017 um
01:57 Uhr:

> Drew Adams <drew.adams@oracle.com> writes:
>
> >> Thanks to you both. I'm working with existing plists, so I'll drop
> >> the setqs, that's a relief.
> >
> > Why is it a relief - a relief from what?  What if something reset your
> "existing plist" to nil behind your back?
>
> The code I'm working has many repeated clauses looking like:
>
> (when thing1
>   (setq the-plist (plist-put the-plist :thing thing1)))
>
> A little more complicated than that, but there will be like seven of
> those in a row. Probably I should just write myself a custom
> bulk-conditional-plist-setter macro, probably using the gv setter, but
> for the time being just being able to remove all the "(setq the-plist"
> makes everything easier to read.
>

 You could also write
(cl-callf plist-put the-plist :thing thing1)


reply via email to

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