all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu')
Date: Sat, 19 Jun 2021 14:31:14 +0200	[thread overview]
Message-ID: <87tulu11f1.fsf@gnus.org> (raw)
In-Reply-To: <CANh=_JHJpubzHU65=+SdHdDM1bpFr9meTsdUHDiU0N3F0N9tig@mail.gmail.com> (Jim Porter's message of "Thu, 17 Jun 2021 20:39:42 -0700")

Jim Porter <jporterbugs@gmail.com> writes:

> Currently, there's not a simple way of inserting a key binding into a
> keymap in alphabetical order. This would be nice for
> `mode-line-mode-menu'; to see the issue, you can run the following:
>
>   emacs -Q
>   <mouse-3> ;; on the mode name in the mode-line
>   ;; See the nice alphabetical list
>   M-x ruler-mode
>   <mouse-3> ;; on the mode name in the mode-line again
>   ;; "Ruler" is first(?!)

Yup; I can reproduce this issue, too.

> 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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2021-06-19 12: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 [this message]
2021-06-21  5:31   ` Jim Porter
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

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

  git send-email \
    --in-reply-to=87tulu11f1.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=jporterbugs@gmail.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.