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

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

Re: Add/remove an element into/from a cons.


From: Tassilo Horn
Subject: Re: Add/remove an element into/from a cons.
Date: Tue, 26 Oct 2021 06:57:08 +0200
User-agent: mu4e 1.7.4; emacs 29.0.50

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> How can I add/remove an element into/from a cons, taking the following
> one as an example:
>
> ```emacs-lisp
> (setq company-backends '((company-tabnine :separate company-capf
> company-dabbrev company-keywords company-files company-ispell)))
> ```
>
> How can I  remove `company-ispell` from and re-add it into the
> company-backends defined above?

You can use `setf' with the place being the alist entry like this
(company-backends replaced with th/test in my example):

--8<---------------cut here---------------start------------->8---
(setq th/test '(( company-tabnine :separate company-capf company-dabbrev
                  company-keywords company-files company-ispell)))

(let ((place (assoc 'company-tabnine th/test)))
  (setf place (remove 'company-ispell place)))
--8<---------------cut here---------------end--------------->8---

HTH,
Tassilo



reply via email to

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