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 10:15:29 +0200
User-agent: mu4e 1.7.4; emacs 29.0.50

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

> I tried with the following function:
>
> ```emacs-lisp
>   (defun hz/scratch-init ()
>     (with-current-buffer "*scratch*"
>       (make-local-variable 'company-backends)
>        (setf (alist-get 'company-tabnine company-backends)
>                (remove 'company-ispell (alist-get 'company-tabnine
> company-backends)))
>      ))
> ```
>
> The above method will set the correct company-backends when I'm on
> scratch buffer. But I also find that when I switch to other buffers,
> says, AUCTeX based LaTeX-mode, the company-backends settings still
> remains the same,

You mean, the above function changes the value not only in *scratch* but
all buffers?  That shouldn't happen, I'd say, as the function explicitly
makes `company-backends' buffer-local in *scratch* before modifying it.

In any case, I think it would be more valuable for any of us if you'd
start a discussion with a statement on what you want to achieve instead
of some non-working snippet of code where the intent is to be
interpreted by the reader.

Bye,
Tassilo



reply via email to

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