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:55:14 +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="37882"; 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:56: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 1mdrHb-0009gC-Ql for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 11:56:15 +0200 Original-Received: from localhost ([::1]:43238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdrHa-0000pa-IX for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 05:56:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdrGq-0000mB-L2 for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 05:55:28 -0400 Original-Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]:42897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdrGo-0001vK-8q for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 05:55:28 -0400 Original-Received: by mail-ua1-x935.google.com with SMTP id j8so6495495uak.9 for ; Fri, 22 Oct 2021 02:55:25 -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=B8zUZ0sD740YxruiJoRCMEbNgqTkKtPOzbtWjbqQC5g=; b=E+arID4XhZb5X17qu3iO70zggtAyWeWwimO8kEH0r24z9cBPUvQQ8b/iWx8SCkmSay XVIyCYyVKZ0at0WD3T/Xyx9IjjFtUtETs1x63bYicLKl+ygXVysD2k9V2ocEZxZ8bMwZ yQAeIQGSl3pwabJuxPM8NX1pPeRI6ZALT2LsGPgsRbhK3x31vOFjOGDkPB0kjFNAmCCF y9afUWL4AmEtQZrrZ72mSphSOxPLZ3xab5RoIuWeoPb5Fv/jL+eVdm7n+zR6OTVvNknF MUBT/nGblyxcLvUThmXT7UwE7EOIMfStPR1uFyoaiu63wkpakFNQMqq/fJUf1daRShvV u0JQ== 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=B8zUZ0sD740YxruiJoRCMEbNgqTkKtPOzbtWjbqQC5g=; b=xgsOdFVtCeZYzP2MioBsz7DPmGxDJT3qqhqOPRYDBv3nYJBGfviX9nwg0kbhwBZxN5 aDgOEpg9Ak5ff1wNg9FR+AClXFi1e5Svt0YvW721yXhKD+G5J9p5/oxSZkOD8MbrR/Bb wtYVK9MLdW0gb4pCTAlFa3mHkYJ+dS/JucavgXNLsQs50ccQ7GNaFo8zZilhoCzX4q/O F430/MOz+NIR2Wqis8o05eAb7vO1Z6yPTtkDu1xvf93A8NEyh7NLmQoNMZy+b/I7sGtp jgu281+Ms98VQFCCM5zFl/n+4WkiTnYCzba9tm0BwA94c19qlQWQczgjvNIBIIX+Sby3 auTA== X-Gm-Message-State: AOAM532eT3gsiaVTz3I4isdGhQK6CZiBEQPGMKDzHVLqgPxME0xIrdIq h1hQBwEtU9frN/HHUySfVhb1CGUVRKI0LKE1idPuTQ4jspx++hfO X-Google-Smtp-Source: ABdhPJzqek2uyrAEFsRdr5Yz20hbhHbFr/+/psz2t5P2fSp8YSX2ie47rJp3goLEXosry/FT+/5o8XeAn7XGVGnoqpU= X-Received: by 2002:a67:c31c:: with SMTP id r28mr13559885vsj.10.1634896525373; Fri, 22 Oct 2021 02:55:25 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::935; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x935.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:134008 Archived-At: On Fri, Oct 22, 2021 at 5:46 PM Hongyi Zhao wrote: > > 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) I brought up the discussion here [1]. [1] https://github.com/company-mode/company-mode/discussions/1244