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: Sun, 24 Oct 2021 08:32:16 +0800 Message-ID: References: <87y26lporl.fsf@zoho.eu> <87pmrxpky4.fsf@zoho.eu> <87lf2lpig4.fsf@zoho.eu> <87h7d9pg14.fsf@zoho.eu> <871r4dpesl.fsf@zoho.eu> <87sfwtnwwj.fsf@zoho.eu> <87a6izzkln.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="28913"; 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 Sun Oct 24 02:33:11 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 1meRRm-0007MC-I3 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 02:33:10 +0200 Original-Received: from localhost ([::1]:43436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meRRl-0004Z1-1f for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 20:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meRR9-0004Yd-QO for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 20:32:31 -0400 Original-Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]:35672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meRR7-00073m-O2 for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 20:32:31 -0400 Original-Received: by mail-ua1-x935.google.com with SMTP id q13so14952140uaq.2 for ; Sat, 23 Oct 2021 17:32:28 -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=64A4u9y/EbU9LCBKBqVCyc2DArLL2eIWwG2pZHuT4fI=; b=FMAtfiauiTpXOost2v1jcXDF5aRAtCLzQvnOLS/R9YzJP7NlfA8l3HSJMXrFR2RClM a+FGq8TVv9KhxCFocMQ/wR3hPOZAlEfrC8Cm03duNo0L9wUKpkhF4W/fj2MNItj1ZVco dbi35twSrzwj8vHmc+IQ3HvtnRtym+azWiuZU9LK0lWJJT+f1X0ROhAWV22XSvqPS100 R/wovnel7JzW+j/A57GHF7FGfd+R0WJEK7P7xfbWMdONPwi1Y7TfgLdgwscNXiNE9yI0 y3bPmjuhJzna31UgekvkDvTHH7QHkMOoMNQ3D/0G2+5meh+arFL5wOEL77hp3aLlS6a+ O6lw== 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=64A4u9y/EbU9LCBKBqVCyc2DArLL2eIWwG2pZHuT4fI=; b=dbwrUGFsB3qae0O5VnKCt4lKiIC7rWv9fwJAwyUwAL/NdmriYKD9+CjdTwsIMhXH/s 7e4QLV6GiM/03lbOqdwiWt6ljdjR7FBgUMlTRwNxJXJHa1m+Wrliyu3wIu2v5VkYamdp P7umimFDO24MQ+YNEw/4/PmX9O/jZ9odDMqvXOiFQChBXv3JAE0W01v0fPDA031DV0JT i1vtTxBk2mMKm70eEX3K9fNfsdfFizbkpEsu+8QBsOlHvhMarmon2408WCiyKXu+hilI W0pq+gafQ9RTg/2y9jmrqK9t8/KaRZTGVklEL28fF7qZgt1UvKCGdc3XEnOFhRcyjxCA QKkQ== X-Gm-Message-State: AOAM531DrBIrRiVEqtvvf15hy179rIHyniM9nSxi0M4ZPGnHvWe9zrJI 7FKuT875b9acefpqdR4h4LmohuhQTOs2OaNG0r6wBpKVztWYiJBa X-Google-Smtp-Source: ABdhPJxTiSpuKJ3iokKPEbwiSd6ddu34tGj539/88ZnON2mR/z9LMnVhUKWpg72Vm8wjW4PVIP8naXgy4X8KrWNGVX0= X-Received: by 2002:ab0:1623:: with SMTP id k32mr8750895uae.71.1635035548239; Sat, 23 Oct 2021 17:32:28 -0700 (PDT) In-Reply-To: <87a6izzkln.fsf@zoho.eu> 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:134074 Archived-At: On Sun, Oct 24, 2021 at 2:01 AM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > >> That's a function so if anything it should be > >> (company-search-abort) > > > > Tried the following, but doesn't work again: > > > > (defun hz-company-search () > > (interactive) > > (if (company-search-abort) > > (company-search-abort) > > (company-search-candidates))) > > > >> ... but it doesn't seem to work like that, in the `if' > >> setting you want something that always is, or can be > >> interpreted as, t or nil ... > > > > What's the trick? > > I'm not aware of a general method - read the documentation, > maybe - but in this case you can just type in in the source > buffer and evaluate it, then you see that it isn't what you > look for. > > (company-search-abort) `C-x C-e` the above command gives the following: if: Company not in search mode HZ