From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap. Date: Sat, 23 Oct 2021 11:20:21 +0200 Message-ID: <87ilxoyu5m.fsf@web.de> References: <87y26lporl.fsf@zoho.eu> <874k98m9wj.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27655"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 23 11:21:30 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 1meDDW-00074I-5O for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 11:21:30 +0200 Original-Received: from localhost ([::1]:52582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meDDT-0004y5-Ua for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 05:21:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meDCZ-0004vx-4S for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 05:20:31 -0400 Original-Received: from mout.web.de ([212.227.15.3]:53347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meDCT-00040b-7D for help-gnu-emacs@gnu.org; Sat, 23 Oct 2021 05:20:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1634980822; bh=rW+pnwLqCNUPU2edLs7qaV0nU2IK6xhoS092zc4tOsM=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=OG+B0pgZF7cDpJW/64n7aHyGNldC/CTEdPZuyu01wsYKSQqe/SmOnaJFQlHNSdTdX rewZ539H1WQ5nTD5Bf0eoxiXgMNERykaS1J87NYtGxFE+M20SPdlLvePIv1AGJY9l9 m6urWazs0bqpQrqS3tFWtxg+hUi3EqE7XQGFJkMY= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([92.208.225.87]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Mf0a9-1mK3kV1CsT-00ObFc; Sat, 23 Oct 2021 11:20:22 +0200 In-Reply-To: (Hongyi Zhao's message of "Sat, 23 Oct 2021 16:48:38 +0800") X-Provags-ID: V03:K1:RK8zDhaueH4tuVKcB1XX57EjZwVIP/C9PPoc/K9W7ezVXLdr7g2 czHB92ErehU67pV0qfLIs1H0dj6AdnW2T5kAmohAwoR614TGbqBKrFQ8rRutHZc7SzXX/DG KkTd2a0cLcmRDAqFkCPZaevQ6qY+OkTp3cRzm8aXDDJ+KqRDCJp/pWkPrKMt4Ht902D5fv3 NEd3+zPRs4N8xO+n+APCQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:LsVIXs/m+ho=:iqN7BKmocV6DjzrvVs+Il5 q/JQFpJVyuBZ30t6uuqqp+W2Hwchmid2CKdZq1HDz4CZ/wwx68noMRwzskGU5VFdImWfHfQwK 4u5LAIead6Lsm70B79LtsJXA28c9xBAeIIt53KQuhgWfSfyilAGRv1j/mj118plbX6P0Upvsu xmFuWrImn5LKMNd+TwCVXLIVNeo/pTIZGxP2JrxKHe6ry7wbbQ6M9rRXd6CynV8Ch77gv0rMj OgpAHwHe38N4NTQmoSK2zTigpYXNNC6peraYnO4Fot5vaTCjgsiBIAsEPFx7GVnjB7xTN4EiE gytgadDZJMjvi3xNscyh//B6qLbRGwtyF/Hr+5oFNPWBwKjjDMN/zOIg5Uv2HXXA4d4yhiRWM CJNUBdmR+um5qmS3dEeJ15ktcqtw+Kh3RFayICjmfjH/DWKYzSwTyRcjRvEnTnRHL2QwzbIBr WgaYcU3azKbQ/JKh1slT7VmS9z4849Zad7IVn9emmZmLzZ5RZI6O/pq5BgoBwJV5p6kGc6DxE KcZpcPHHblpb5AR2pBPGjyi50RT2+QMaC/xh3TSsXWzoMdN63kCS8AyZLQyxUHE8I5uqJRy/H K8jWOHG82IEwx+erTaXK6DvDEF6qqkSsDlKRjn+HO4BtI+AlJiSP2C9EP2z0do3IsAYP2csf0 6fOy5hmfXwj3/exXTj4Lt0EBH5fwsIhNq2Mee9czkvKiPjkqYpbdLDu0vMoUyYlwTybjD85RJ /uZ2C9G2v3sACpb2bR854vRoPnn2JNKsKy9xjO7o1Fzqfrv19XQ66RoPX+lQ9/WeKEx6Niil Received-SPF: pass client-ip=212.227.15.3; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:134043 Archived-At: Hongyi Zhao writes: > > Hongyi Zhao writes: > > > > > ("" . (lambda () > > > (interactive) > > > (if (company--active-p) #'company-search-abort > > > #'company-search-candidates))) > > > > Your lambda only returns a command name, but it doesn't call any > > command. It will just do "nothing". > > I'm in a confusion for this problem. The fix? If it's not obvious to you why this does nothing, you need to learn more basics. Let's name the command: (defun my-command () (interactive) (if (company--active-p) #'company-search-abort #'company-search-candidates)) When you eval that definition and do M-x my-command, what would you expect to happen? Michael.