From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Add/remove an element into/from a cons. Date: Tue, 26 Oct 2021 08:36:44 -0400 Message-ID: References: <875ytkqt4x.fsf@gnu.org> <871r48qpuv.fsf@gnu.org> <87sfwop8iu.fsf@gnu.org> <87o87cp3fs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18832"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Hongyi Zhao , help-gnu-emacs To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 26 14:38:08 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfLiR-0004i0-4y for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 14:38:07 +0200 Original-Received: from localhost ([::1]:50570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfLiP-0007Ms-QV for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 08:38:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfLhE-0007MJ-9c for help-gnu-emacs@gnu.org; Tue, 26 Oct 2021 08:36:52 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfLhC-0001Bm-NO; Tue, 26 Oct 2021 08:36:51 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 81EA01002CE; Tue, 26 Oct 2021 08:36:48 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4812F100091; Tue, 26 Oct 2021 08:36:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1635251806; bh=VA3AE4ckL1WsZq9dYF7zeQaKb23uat7o1blTR2CBS7g=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=c1u5jTuKG7pQfIxSkIFiNrzcNyOnYXaw778Gx15gzprpZ+qNICXIIHlrFuP8jItdh 5vEBjKOhQuVRh2Yi43KvMR8EGMlopO3I+04SBS5QbjcthDYjvhFmwPjpgfvMKaKKqy 5yA9P4oFlTyU5aSnulELRId8T4nhtkVsNtD8/iDAupiic3NOIEg26EC30jRkAxWsIu rV5cS3Cqc588uumyoZ+nvxwYftFGa2yhG3RdfIwfnboax4Q7z3M6kkWBR2oawyxitx iYE+KLsMB+wWak6CBJZtxDK7uJxzAU7dcsG058wGJjmzgZgiObqoyc8tFNKuJlHKK6 /hmQTywYTH0Qg== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EF34B1202C1; Tue, 26 Oct 2021 08:36:45 -0400 (EDT) In-Reply-To: <87o87cp3fs.fsf@gnu.org> (Tassilo Horn's message of "Tue, 26 Oct 2021 10:15:29 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134204 Archived-At: Tassilo Horn [2021-10-26 10:15:29] wrote: > Hongyi Zhao 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. The `setf` above changes the data structure by side-effect. It does not change the variable itself. Stefan