unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [Suggestion] New function `sorted-key-descriptions'
@ 2003-05-02 19:54 Wedler, Christoph
  2003-05-04 13:03 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Wedler, Christoph @ 2003-05-02 19:54 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Suggestion] New function `sorted-key-descriptions'
  2003-05-02 19:54 Wedler, Christoph
@ 2003-05-04 13:03 ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2003-05-04 13:03 UTC (permalink / raw)
  Cc: emacs-devel

    [1] This function is already defined in XEmacs.

That is a good enough reason to add the function, I guess.  Did you
write the code yourself, or did you copy it from XEmacs?  If the
latter, who actually wrote it, and do we have papers from him for it?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Suggestion] New function `sorted-key-descriptions'
@ 2003-05-05 12:53 Wedler, Christoph
  2003-05-05 19:11 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Wedler, Christoph @ 2003-05-05 12:53 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

 >     [1] This function is already defined in XEmacs.

 > That is a good enough reason to add the function, I guess.  Did you
 > write the code yourself, or did you copy it from XEmacs?  If the
 > latter, who actually wrote it, and do we have papers from him for it?

The code for `sorted-key-descriptions' is copied from XEmacs:

 - 4 lines function body (the same as part of the code in
   `icomplete-get-keys', also in Emacs)
 - 1 line function head
 - 3 lines docstring

I don't know whether you need papers in this case.  Here is the
corresponding entry in XEMACS/lisp/ChangeLog.1:

1997-07-11  Hrvoje Niksic  <hniksic@srce.hr>
        [...]

	* prim/help.el (sorted-key-descriptions): New function.

CC to Hrvoje Niksic <hrvoje@xemacs.org>.

- Christoph

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Suggestion] New function `sorted-key-descriptions'
  2003-05-05 12:53 [Suggestion] New function `sorted-key-descriptions' Wedler, Christoph
@ 2003-05-05 19:11 ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2003-05-05 19:11 UTC (permalink / raw)
  Cc: emacs-devel

We have papers from Hrvoje, so I we can use his code.
Would someone like to install that function?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-05 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-05 12:53 [Suggestion] New function `sorted-key-descriptions' Wedler, Christoph
2003-05-05 19:11 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-05-02 19:54 Wedler, Christoph
2003-05-04 13:03 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).