unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu')
Date: Sun, 20 Jun 2021 22:31:44 -0700	[thread overview]
Message-ID: <ea662eec-a88e-9197-131b-aaafdd477142@gmail.com> (raw)
In-Reply-To: <87tulu11f1.fsf@gnus.org>

On 6/19/2021 5:31 AM, Lars Ingebrigtsen wrote:
> Jim Porter <jporterbugs@gmail.com> writes:
> 
>> I've attached a simple patch that fixes this by adding a
>> `define-key-sorted' function. I imagine it still needs some work to
>> handle more complex cases, but it works well enough for
>> `mode-line-mode-menu'.
> 
> Hm...  instead of adding a new function, perhaps it would make more
> sense to just make the mode menu sort entries before displaying?

That would also work, and have the added benefit that it's resilient 
even if a package neglects to use `define-key-sorted'.

I'll look into the best way to trigger a sort just before opening the 
menu. Ideally, we could avoid re-sorting every time (unless the list has 
changed), but that might be more work than it's worth, given that the 
list is unlikely to be more than a few dozen elements.

- Jim



  reply	other threads:[~2021-06-21  5:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  3:39 [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu') Jim Porter
2021-06-19 12:31 ` Lars Ingebrigtsen
2021-06-21  5:31   ` Jim Porter [this message]
2021-06-21 12:31     ` Lars Ingebrigtsen
2021-06-23  5:17       ` Jim Porter
2021-06-23 13:06         ` Lars Ingebrigtsen
2021-06-23 13:58           ` Stefan Monnier
2021-06-23 14:10             ` Lars Ingebrigtsen
2021-06-23 16:50             ` [Updated Patch] " Jim Porter
2021-06-24 14:51               ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=ea662eec-a88e-9197-131b-aaafdd477142@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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 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).