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 19:22:50 +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> 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="23382"; 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 13:24:00 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 1mdseW-0005qD-Sa for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 13:24:00 +0200 Original-Received: from localhost ([::1]:49356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdseV-0006vN-Ag for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 22 Oct 2021 07:23:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdsdb-0006tQ-UN for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 07:23:03 -0400 Original-Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]:45661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdsda-0006Yx-Bs for help-gnu-emacs@gnu.org; Fri, 22 Oct 2021 07:23:03 -0400 Original-Received: by mail-vk1-xa31.google.com with SMTP id n201so1286864vkn.12 for ; Fri, 22 Oct 2021 04:23:02 -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=WIxqutwgEXqhchomHcnepvWhx3a1SxXCvyOjSh40eME=; b=j7sG6b/2OSC2p6jsO5Rh3uvK7rouh1JFb9dRrHGIPU/LNIHR5SoQnF8ummKycm2t2Y 2cJgY6cnlPc75kj4sYgebEZbE8EZE9FQUODVEmpowT1jhrwXN2tv5FLqTrXQ6GCiuZex 2z1/8Ule+PXGbY+La7mqA9+x+z/LHO/2GwhshxPBeMTKQwYgTKFD5FMd5gc/Ap93cHHD MJc/fuwxVq2JFy/6ADdjM0/BTDO1VXFhSts4Fbjj7RkNnmJfs2OKFnDEKmW2GS28CWLp ShYHvZQ9YcxpyiIgWYAWWRS6KvVkmxHPnh5qglC+EGxxtvpTcdmJrur5B8gw2dpK5Ab2 P7fg== 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=WIxqutwgEXqhchomHcnepvWhx3a1SxXCvyOjSh40eME=; b=a+a/gfSzudahoaxtQnmtNKjSH312BPbH2FsrAQ8CSst6fTjDxb7HHAgevjjF2HGC7W +Eu9eW/tQ58zyFTj111/48hB7hGT2SaMnzl7V12oytV+4sKwV0iGEFQiHGOuSXjmpGaU 00U8H/u9jq6apMl+nBmxWZ2/7m/TEeT9QCvPiNLMD/5vnbbyUo50hT5/AXe/9k0FzjLs 7H3XSCxqn7MiR9BoKJi15YO1AYmus/mepMu8bVLkYedhDf6hRaWwf1sZ+4qoxfIH4TGH F3P1IuiouQRkgeeXnAuSseucYimSdYQPr8gdG1vlpuMuQR8Z38YpPvI6/eodgXFR62z6 tvFg== X-Gm-Message-State: AOAM5337Ha7CG73pyaQUgq0McjQv1hSzCqXYZTqbnICBzFit5yVIRDwO YwgVYmnP4qYPk/EoWWei8PoeZicuZJFdxvqfzTo= X-Google-Smtp-Source: ABdhPJwTXKf7nNNkAnJrbuJzZ+rKmSeAXWRxE9NufKlogERAQHJPa5TqJFp/bBVthRfFqsWehvZkmEeTfCwSnPQM8vo= X-Received: by 2002:a05:6122:1812:: with SMTP id ay18mr13281039vkb.14.1634901781328; Fri, 22 Oct 2021 04:23:01 -0700 (PDT) In-Reply-To: <87sfwtnwwj.fsf@zoho.eu> Received-SPF: pass client-ip=2607:f8b0:4864:20::a31; envelope-from=hongyi.zhao@gmail.com; helo=mail-vk1-xa31.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:134012 Archived-At: On Fri, Oct 22, 2021 at 7:05 PM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > > (defun hz-company-search () > > (interactive) > > (if company-search-abort > > (company-search-abort) > > (company-search-candidates))) > > > > (define-key company-active-map "\t" #'hz-company-search) > > (define-key company-search-map "\t" #'hz-company-search) > > 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?