all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Wedler, Christoph" <christoph.wedler@sap.com>
Subject: [Suggestion] New function `sorted-key-descriptions'
Date: Fri, 2 May 2003 21:54:09 +0200	[thread overview]
Message-ID: <67B8CED503F3D511BB9F0008C75DAD66054855C8@dewdfx17> (raw)

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 <right>
    instead C-f as the first binding of `forward-char'.

- Christoph

[1] This function is already defined in XEmacs.

             reply	other threads:[~2003-05-02 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 19:54 Wedler, Christoph [this message]
2003-05-04 13:03 ` [Suggestion] New function `sorted-key-descriptions' Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-05-05 12:53 Wedler, Christoph
2003-05-05 19:11 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67B8CED503F3D511BB9F0008C75DAD66054855C8@dewdfx17 \
    --to=christoph.wedler@sap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.