unofficial mirror of emacs-devel@gnu.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: Wed, 23 Jun 2021 15:06:23 +0200	[thread overview]
Message-ID: <87a6ngn31s.fsf@gnus.org> (raw)
In-Reply-To: <44969496-4f6c-e299-9fee-7bad01c17815@gmail.com> (Jim Porter's message of "Tue, 22 Jun 2021 22:17:34 -0700")

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	other threads:[~2021-06-23 13:06 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
2021-06-21 12:31     ` Lars Ingebrigtsen
2021-06-23  5:17       ` Jim Porter
2021-06-23 13:06         ` Lars Ingebrigtsen [this message]
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=87a6ngn31s.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 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).