[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mutate list by appending a list (and similar for props)
From: |
Sam Halliday |
Subject: |
Re: mutate list by appending a list (and similar for props) |
Date: |
Thu, 18 Sep 2014 02:42:03 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Thursday, 18 September 2014 10:37:52 UTC+1, Sam Halliday wrote:
> On Monday, 8 September 2014 20:29:17 UTC+1, Barry Margolin wrote:
>
> > Sam Halliday <sam.halliday@gmail.com> wrote:
>
> > > I often find that I am repeating calls to add-to-list (mutates) /
> > > plist-put
>
> > > (immutable) in my .emacs [1] configuration against the same variable. I'd
>
> > > like to be able to pass a list of elements to be appended/prepended to
> > > the
>
> > > variable to save on boilerplate.
>
> >
>
> > > It would be trivial to write a little function that repeats the operation
> > > for
>
> > > a list input, but I'd rather use something that is already in the emacs
>
> > > distro (or at least in a very lightweight MELPA package).
>
> >
>
> > > Does such a thing exist?
>
> >
>
> >
>
> >
>
> > The append function does it:
>
> >
>
> > (setq list (append additional-list list))
>
>
>
>
>
> Thanks! But that's not ideal because it involves repeating the list symbol
> (which can often be quite long).
(It also doesn't work when the original list is nil)