From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Wedler, Christoph" Newsgroups: gmane.emacs.devel Subject: [Suggestion] New function `sorted-key-descriptions' Date: Fri, 2 May 2003 21:54:09 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <67B8CED503F3D511BB9F0008C75DAD66054855C8@dewdfx17> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: main.gmane.org 1051905454 31914 80.91.224.249 (2 May 2003 19:57:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 2 May 2003 19:57:34 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri May 02 21:57:33 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Bgez-0008Ia-00 for ; Fri, 02 May 2003 21:57:33 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Bggg-0007HY-00 for ; Fri, 02 May 2003 21:59:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19BgdS-0001Si-04 for emacs-devel@quimby.gnus.org; Fri, 02 May 2003 15:55:58 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19Bgcg-0000fP-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:55:10 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Bgc0-000806-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:54:33 -0400 Original-Received: from smtpde02.sap-ag.de ([155.56.68.170]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Bgbn-0007G5-00 for emacs-devel@gnu.org; Fri, 02 May 2003 15:54:15 -0400 Original-Received: from sap-ag.de (smtpde02) by smtpde02.sap-ag.de (out) with ESMTP id VAA06437 for ; Fri, 2 May 2003 21:54:29 +0200 (MESZ) Original-To: "Emacs-Devel (E-mail)" X-Mailer: Internet Mail Service (5.5.2656.59) X-SAP: out X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13630 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13630 I would like to see the following function defined in Emacs[1]: (defun sorted-key-descriptions (keys &optional separator) "Sort and separate the key descriptions for KEYS. The sorting is done by length (shortest bindings first), and the bindings are separated with SEPARATOR (\", \" by default)." (mapconcat 'key-description (sort keys #'(lambda (x y) (< (length x) (length y)))) (or separator ", "))) You might argue that these 4 lines are not really worth to make a function out of it, Emacs should use that code at the 3..5 places where it is needed, but here are some reasons to make a function out of it: 1. Such a function helps ensuring a consistent user interface: currently, the key distriptions are ordered for icomplete.el, but not in `where-is' and `apropos-print'. 2. The sorting could be made smarter/customizable in the future: e.g., one could imagine that non-console users would prefer to see instead C-f as the first binding of `forward-char'. - Christoph [1] This function is already defined in XEmacs.