From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Add/remove an element into/from a cons. Date: Tue, 26 Oct 2021 14:39:51 +0800 Message-ID: References: <875ytkqt4x.fsf@gnu.org> <87wnm0papx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6279"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 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 09:56:29 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 1mfHJs-0001Ni-Ls for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 09:56:28 +0200 Original-Received: from localhost ([::1]:41146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfHJr-0004ws-Ge for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 03:56:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfG83-0001ny-8J for help-gnu-emacs@gnu.org; Tue, 26 Oct 2021 02:40:12 -0400 Original-Received: from mail-ua1-x936.google.com ([2607:f8b0:4864:20::936]:33455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfG7y-0002xy-Jd; Tue, 26 Oct 2021 02:40:08 -0400 Original-Received: by mail-ua1-x936.google.com with SMTP id s4so2888463uaq.0; Mon, 25 Oct 2021 23:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sWYKCHv6CmlewyZ5SEMG/nTg5IUlv8WiUgmg855iDXQ=; b=DssG3mIMtSUvCSNME24LKnhqUXoCGg+wWkWeRdmBS+LzihTgRGkZNzRLS6By1Biw8t 2K0apUu28MG1HfmYaOxJ4g5ABsVG2YB5CY8hh2CMLqVHQAUT6IANQ10VdAnWfROe2Ukr GJvsa8rEwN562mdbjcdhMlBi14FNtOdzi5eoUvsmMUsWFd0mjuzw6yMWGB2xiUOT9yVy ZeKFaSXCfdRCz84Anb1efPYf8RGhAi41PtbFFCr+u3OF/L1Ve7Ld8U54r3gRF/l4b4ra /ZPUBCVyJpY4k6eK9srsY/7QcbJPC3cBcKfGvLFcRycGSMYCJv7l6MlVkRcHItOJ5e5L 19Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sWYKCHv6CmlewyZ5SEMG/nTg5IUlv8WiUgmg855iDXQ=; b=Bm2aPza5Px4zRkrNHu4V8sfM6N2ntyzfqr8bjZ8zueszCykpM+2xoqsW7XivRN4SRX I0nsdjueEmgn8H9gig9BUxO/ZIbtdjB6JrKAblGggCJXmsMF2LCWy38XyPsJVuOpuzkt z3fGO2BpEzh5uYRCM/sNUjjcGsb8TVOoyEvzU65CgcxALJX2a8k+/jBS9ZoKlgJbEoig XD8fhSs/fKYf4DWWbpc/Bh21HZX+qC/FBpH5ybjolkf6RjedRrEiUXshXbPNoglj4Pxe hTB5IL2gMswGkL/k8MJ05X89NAyq6jYKwQZ3/x29K57q9NOw94fyIYo912lqsNSb0UVg d1kA== X-Gm-Message-State: AOAM531Bty7ve3rjHxhlr8eo0JNRWZuIwZkTu+MBqyNk1+Kvbci4eWWc nOjHsd66n0IMuCXey9qXHEasAS/gkU/HBqD+Dp70/mN4JBQMJ++b X-Google-Smtp-Source: ABdhPJwo7sF0iwAWaU2o00Y/GinshyjOs80MN5j5ctlw3FmNhK0cn3T6Qz3BGcU2eOjnO20/LTnk1pKtR5hCPihytIY= X-Received: by 2002:a67:c29d:: with SMTP id k29mr21138392vsj.51.1635230402875; Mon, 25 Oct 2021 23:40:02 -0700 (PDT) In-Reply-To: <87wnm0papx.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::936; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x936.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:134188 Archived-At: On Tue, Oct 26, 2021 at 2:21 PM Tassilo Horn wrote: > > Hongyi Zhao 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... The default value is set this way, as I've posted: (setq company-backends '((company-tabnine :separate company-dabbrev company-keywords company-files company-ispell company-capf))) > (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