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: Bind two commands to one key to toggle between them for the same local keymap. Date: Fri, 22 Oct 2021 17:46:22 +0800 Message-ID: References: <87y26lporl.fsf@zoho.eu> <87pmrxpky4.fsf@zoho.eu> <87lf2lpig4.fsf@zoho.eu> <87h7d9pg14.fsf@zoho.eu> 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="32775"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 22 11:47:16 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 1mdr8t-0008KG-F2 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 11:47:15 +0200 Original-Received: from localhost ([::1]:36780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdr8s-0004XR-52 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 05:47:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdr8K-0004XF-F6 for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 05:46:40 -0400 Original-Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]:40856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdr8F-00033C-AB for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 05:46:37 -0400 Original-Received: by mail-ua1-x92a.google.com with SMTP id e2so6473471uax.7 for ; Fri, 22 Oct 2021 02:46:33 -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; bh=QmOrCKPS20fdcnYCkciDzHQxibBo88QHy888e0iUQWs=; b=e81pF6G+3xpIAbzP2p7LDPIs4BD5ToBU5Co0LErT8OgmMha1bSLD8WrE4ba0Wljx9k yHPQO5c1rWOoJARiKK6ZiJw84btFjBRzA1bCs8j/Rj+KalGRKf47HZHY5Gg56QZXwiDE 5trJGMeTEd7yZtjaQ5FBKh5SPzxw2tw62J2mlNrdA/WK3bZslCaSpjxg0nCR3fRxXnb0 Gyjc+y9ue54JVPXjV9N810OmD/rC+YiuoWPDxv4Kone9UBrEqkT3E9lfWgyryI5UhtAA UdQ9SyROpwr4CMMHBpXi3tdSWX1CCmE0fa+s4Vup8XQBrGba8XgKh1nXAFdXepLrgftx E7kw== 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; bh=QmOrCKPS20fdcnYCkciDzHQxibBo88QHy888e0iUQWs=; b=Vtg1CJ+0zgwjgXVzF9tcq7S2UZnRgFpk9VhLy4bqseWSvsbqJ9Gff1ZFQuODpCAcAk 6xP4hnyodT9ky/VFiQI4D23K6sS59YHR20Z2CncQX8D2tYj/msdmMoHe1gT/87a29Fk9 WZoz3oMTazH176LBJQh/eC7Edzz0cnnAqf8L8vElPGCadY1FrZtsCndKAKg2EZHnvHT2 3tW7vOSo1gkuLbzFVu1OR0ERZzakPtNp4VzSqL552eTwbidPjoEmyU8tlWqh4bNgt4Yb bsLrgymHFI4qSGrMDc++WbvdcUT0QylURQH8JVwgODOV5SpNl0MNVUZSEJGGv05+L7i5 EwEQ== X-Gm-Message-State: AOAM533K45pApGacnPjkkSovMRBenelp4BgKRmp8Ps9D0EM/ioup63+/ jbEPRiLWiQg6GckwxUYgabWQsi8+IQFvSReRTWc= X-Google-Smtp-Source: ABdhPJzbtl8mmPTdc8yps6zXXm6NB2S53lt4PxTaSLkxjVmcT+LwKfgaOYstE9OnDYoHXSYhCpcCWMRj/yHv9hRmBDc= X-Received: by 2002:a67:c29d:: with SMTP id k29mr13650853vsj.51.1634895992885; Fri, 22 Oct 2021 02:46:32 -0700 (PDT) In-Reply-To: <87h7d9pg14.fsf@zoho.eu> Received-SPF: pass client-ip=2607:f8b0:4864:20::92a; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x92a.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:134005 Archived-At: On Fri, Oct 22, 2021 at 5:26 PM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > > Thank you for your idea. `company-search-mode' is a minor > > mode > > Okay, my mistake, then just use the variable, i.e. > `company-search-mode'. > > (if company-search-mode ... ) I changed to the following code snippet, but got the same result: (defun hz-company-search () (interactive) (if company-search-mode (company-search-abort) (company-search-candidates))) (define-key company-active-map "\t" #'hz-company-search) (define-key company-search-map "\t" #'hz-company-search) HZ