emacs-devel
[Top][All Lists]
Advanced

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

Re: inverse of add-to-list: remove-from-list


From: Thibaut Verron
Subject: Re: inverse of add-to-list: remove-from-list
Date: Wed, 14 Oct 2020 07:58:14 +0200

Le mar. 13 oct. 2020 à 15:58, Stefan Monnier
<monnier@iro.umontreal.ca> a écrit :
>
> Uwe Brauer [2020-10-13 10:42:46] wrote:
> > This has always bothered me: for example
> >
> > (add-to-list 'org-export-filter-src-block-functions
> >          'my-html-filter-src-blocks)
>
> I think this reflects a misdesign in `org-export-filters-alist`.
> It should use hooks rather than lists of functions.  This way you'd use
> `add-hook` instead of `add-to-list`.

I might be missing something, but where would the harm be in using

> (add-hook 'org-export-filter-src-block-functions 'my-html-filter-src-blocks)

even if it is not a hook?

> I think if we want to add something to remove an element from a variable
> holding a list, then we should make it accept a "place" rather than
> a symbol as argument.  I.e. make it the opposite of `push` (or
> `cl-pushnew`) rather than the opposite of `add-to-list`.
>
> Stefan "who dislikes `add-to-list`"

It looks like for that we already have remove and cl-remove indeed.

So basically the answer would be, instead of looking for an opposite
to add-to-list, use cl-pushnew which has a natural opposite in
cl-remove. Is that so?

For an exact opposite to remove, should there be an alias to the wrapper below?

> (lambda (elt place) (pushnew elt place :test 'equal))



reply via email to

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