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: Lars Ingebrigtsen
Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu')
Date: Wed, 23 Jun 2021 15:06:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jim Porter <jporterbugs@gmail.com> writes:

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

Thanks; looks good, so I've applied it to Emacs 28 (with some trivial
changes).

> +         (sort (cdr keymap)
> +               (lambda (a b)
> +                 (string< (bindings--menu-item-string (cdr-safe a))
> +                          (bindings--menu-item-string (cdr-safe b)))))))
> +    (setcdr keymap menu-items)

I'm slightly worried about this, though -- will altering the keymap
structure have any adverse side effects?  I don't think so, and testing
a bit doesn't seem to reveal anything obvious, but we should be on the
lookup.

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



reply via email to

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