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 08:18:44 +0200
User-agent: mu4e 1.7.4; emacs 29.0.50

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

> (defun my-scratch-init ()
>   (with-current-buffer "*scratch*"
>     (setq-local company-backends (let ((place (assoc 'company-tabnine
> company-backends)))
>                    (setf place (remove 'company-ispell place))))
>     ))

setf returns the new value, so here you are setting company-backends to
the modified alist entry, not the alist itself.  This should work:

--8<---------------cut here---------------start------------->8---
(defun my-scratch-init ()
  (with-current-buffer "*scratch*"
    ;; Ensure it has a local variable.  Not sure if it has by default...
    (make-local-variable 'company-backends)
    (let ((place (assoc 'company-tabnine company-backends)))
      (setf place (remove 'company-ispell place)))))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



reply via email to

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