From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60530: 28.2; Add tools to find keymaps that bind a given command Date: Mon, 20 Feb 2023 15:09:24 +0200 Message-ID: <83ilfwv5yz.fsf@gnu.org> References: <9D2761CB-E158-4D8A-876B-CE1AE0F9ACEA@toadstyle.org> <83a618wo10.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34568"; mail-complaints-to="usenet@ciao.gmane.io" Cc: spd@toadstyle.org, 60530@debbugs.gnu.org To: Ruijie Yu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 20 14:10:28 2023 Return-path: Envelope-to: geb-bug-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 1pU5w2-0008iq-Lf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Feb 2023 14:10:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU5vt-00010I-Tc; Mon, 20 Feb 2023 08:10:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU5ve-0000zk-Io for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:10:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pU5ve-0005Bq-8c for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pU5ve-0002GJ-4L for bug-gnu-emacs@gnu.org; Mon, 20 Feb 2023 08:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Feb 2023 13:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60530 X-GNU-PR-Package: emacs Original-Received: via spool by 60530-submit@debbugs.gnu.org id=B60530.16768985668646 (code B ref 60530); Mon, 20 Feb 2023 13:10:02 +0000 Original-Received: (at 60530) by debbugs.gnu.org; 20 Feb 2023 13:09:26 +0000 Original-Received: from localhost ([127.0.0.1]:50949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU5v4-0002FO-8F for submit@debbugs.gnu.org; Mon, 20 Feb 2023 08:09:26 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU5v2-0002FC-Sa for 60530@debbugs.gnu.org; Mon, 20 Feb 2023 08:09:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU5ux-000547-8v; Mon, 20 Feb 2023 08:09:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HfnH5V+E1IJ0r2cgbS36d+mxM1onOeGmD1fPKsQgq3g=; b=BPN8XVNUQzE0 vq86xcjI+IgtSXbdMZJJ98+907q4jZkuFCcWXuvjhKBp42ncqtZZAl5Oooi72Se+GddovvKdmaunf RsQf3sivl+OxhPN8GGz1AFya1bK67RwWw530oyxb6qrpqw3BzzsFfic49/61peo4JyC9pzLTi2d3G EFtzrPkkrJOqfdoceA1AgsKjEsgwXRsfTniigd7PIFhvxbn+HimdE7VMdJtYvj0HhY6q79rMAh36E J8eesjhS1ptgobwU0h7lpnodvTaUMpeVMHjT8fcSntIpks0n4t7EYW5pvYHqKc3LR5jbah2mxDIP6 G2IrHcTJ0zaAPz5C6ItcHQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU5uu-00057b-3i; Mon, 20 Feb 2023 08:09:18 -0500 In-Reply-To: (message from Ruijie Yu on Mon, 20 Feb 2023 20:01:27 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256167 Archived-At: > From: Ruijie Yu > Cc: spd@toadstyle.org, 60530@debbugs.gnu.org > Date: Mon, 20 Feb 2023 20:01:27 +0800 > > > Eli Zaretskii writes: > > >> Cc: 60530@debbugs.gnu.org > >> Date: Mon, 20 Feb 2023 15:07:09 +0800 > >> From: Ruijie Yu via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> I saw this message long ago, but recently I came across a situation > >> where I wanted to know if a command was bound in *some* keymap whose > >> name I didn't know, and this would be quite a helpful feature for me > >> personally (pun intended). > > > > Isn't that what where-is and/or where-is-internal already do? > > No, not quite. The functions where-is{,-internal} only look for > *currently active keymaps*, whereas my intention was to look for all > keybinds for the specified command, be it active or not. But that's impossible in principle, because loading some package could produce a binding for a command, and you don't know which packages will be loaded into a session before they are actually loaded. Or what am I missing? > The following is my reason to want this feature. I use pyim, an input > method that shows candidate words in a small frame (which I believe is > called posframe?), which has `pyim-mode-map' enabled. Then, while > typing, I want to know how to call the `pyim-next-page' command without > going into pyim source. > > If I type M-x where-is, this frame disappears, and I am dropped back > into the editing buffer, which does not have `pyim-mode-map' enabled. > Hence, `where-is' does not show anything bound for `pyim-next-page', > because it indeed is not bound globally. FTR, C-h b does not work > either. If what where-is does doesn't suit your needs for reasons of its UI or how it switches buffers, you could extract (parts of) its code and make a similar function which presents the results in a way that doesn't interrupt your workflow. My point in mentioning the existing commands is that they already show how to find bindings for an arbitrary command, so you could reuse some or all of that code for your purposes (which sound very similar to me).