emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use wi


From: Jim Porter
Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu')
Date: Tue, 22 Jun 2021 22:17:34 -0700

On 6/21/2021 5:31 AM, Lars Ingebrigtsen wrote:
Jim Porter <jporterbugs@gmail.com> writes:

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.

Yeah, menus are usually short, so just sorting should be fine, I think.

Attached is a patch that I think should do this. I've only tested the new functions with `mode-line-mode-menu', so they might not work on all menus (hence, I've made them private for now). It's possible these functions would be more broadly useful, though.

Performance-wise, the cost is negligible for the default value of `mode-line-mode-menu': ~10ms for the first time and 0.02ms for subsequent calls.

- Jim

Attachment: 0001-Sort-the-items-in-mode-line-mode-menu-before-display.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]