emacs-devel
[Top][All Lists]
Advanced

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

[WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `


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

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(?!)

I believe `ruler-mode' is the only place in Emacs itself that has this
issue, but third-party packages (or user configs) might want to add to
`mode-line-mode-menu'. For example, I prefer to get rid of the
mode-line lighter for `company-mode' and put an item for it into
`mode-line-mode-menu' for the rare times I want to check/change its
status. Especially with packages that get loaded after startup, the
current behavior could be somewhat confusing since the order items are
added to the menu can vary.

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

- Jim

Attachment: 0001-Add-define-key-sorted-to-simplify-entering-menu-item.patch
Description: Binary data


reply via email to

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