From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Qs on key-description, substitute-command-keys Date: Sat, 15 Oct 2005 07:25:33 -0700 Message-ID: References: <878xwvvx36.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1129386404 11797 80.91.229.2 (15 Oct 2005 14:26:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Oct 2005 14:26:44 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 15 16:26:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQmzJ-0006jd-SZ for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 16:26:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQmzJ-0000UP-0t for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 10:26:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQmyu-0000QL-3I for emacs-devel@gnu.org; Sat, 15 Oct 2005 10:25:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQmyr-0000PC-6E for emacs-devel@gnu.org; Sat, 15 Oct 2005 10:25:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQmyr-0000P8-3z for emacs-devel@gnu.org; Sat, 15 Oct 2005 10:25:49 -0400 Original-Received: from [141.146.126.231] (helo=agminet04.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EQmyr-0004KO-2p for emacs-devel@gnu.org; Sat, 15 Oct 2005 10:25:49 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by agminet04.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j9FEPlso004758 for ; Sat, 15 Oct 2005 09:25:47 -0500 Original-Received: from rgmsgw300.us.oracle.com (localhost [127.0.0.1]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j9FEPlla031170 for ; Sat, 15 Oct 2005 08:25:47 -0600 Original-Received: from dradamslap (dhcp-amer-rmdc-csvpn-gw4-141-144-96-159.vpn.oracle.com [141.144.96.159]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id j9FEPiJ9031144 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 15 Oct 2005 08:25:46 -0600 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Importance: Normal In-Reply-To: <878xwvvx36.fsf@jurta.org> X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44073 Archived-At: > Does anyone know how to control which of several bindings for > a command is displayed by `substitute-command-keys'? There is the same problem for the key suggestion feature activated by `suggest-key-bindings' displaying in the echo area only the "first" key binding which is not always better than other key bindings. A good solution is to suggest all key bindings in the echo area just like `where-is' (`C-h w') does. Perhaps it is not a good solution for `substitute-command-keys' to replace key descriptions with all key bindings since the resulting string might be too long. However, how about introducing a new convention that all strings on which `substitute-command-keys' is used should be designed to reserve enough space for the case when the command is not on any keys, and so `M-x COMMAND' is printed. The size of the command name plus 4 characters of the "M-x " string should define the maximum length of allowed substitutions, and if the command is bound to several key, then to print as many keys as many of them fits into this limit. For example: M-x scroll-left -> defines the maximum 15 characters C-next, C-x < -> both keys fit into 15-characters limit, so replace \[scroll-left] with both keys I appreciate the response, and the workaround suggestion. However, this convention will not work for many uses of `substitute-command-keys', because the helpful prompt, message or help text 1) already has a premium on space and, more importantly, 2) often mentions more than one key. Here's an example of text I append to the minibuffer prompt during completion: (substitute-command-keys " (\\\\[icicle-apropos-complete], \ \\[icicle-prefix-complete]: list, \\[icicle-completion-help]: help) ") That produces this text: " (, TAB: list, C-h: help) " If each of these commands had several bindings, the result would be not only long but incomprensible. Even something like the "tab" key can involve multiple bindings, to deal with different kinds of terminals.