emacs-which-key icon indicating copy to clipboard operation
emacs-which-key copied to clipboard

Local-then-key sort order not respected until docstrings toggled.

Open ScottFreeCode opened this issue 4 years ago • 3 comments

I have set which-key-sort-order to which-key-local-then-key-order, but if I go into a buffer with local keymaps (e.g. M-x customize-option and, once an option is selected, C-c includes C-c C-c -> Custom-set) its local keys are still displayed in alphabetical position among global keys.

Unless I then hit C-h d, which sorts them as expected (local first). NOTE: if I C-g and then enter the prefix again, the docstrings are still on but the sorting is wrong again till I turn the docstrings back off with another C-h d: it isn't whether the docstrings are shown, it's whether they've been toggled. (Toggling them twice in a row without leaving the prefix, e.g. C-c C-h d C-h d, reverts to the original docstring setting while leaving the sort order fixed.)

Using Emacs 26.3, which-key 20191221.1857

I can provide screenshots if that would help; let me know if you need anything else to reproduce.

which-key configuration
 '(echo-keystrokes 0.1 nil nil "This is also set by which-key, but we want it to be lowered even if which-key is missing.")
 '(which-key-compute-remaps t)
 '(which-key-echo-keystrokes 0.1 nil nil "I do not know why they need a separate setting for this, but if we do not set it which-key overrides our regular echo-keystrokes setting.")
 '(which-key-idle-delay 0.1)
 '(which-key-is-verbose t)
 '(which-key-mode t)
 '(which-key-show-prefix (quote mode-line) nil nil "redundant in most cases but (mostly) avoids wiping out echo area in commands that use both it and a transient map (e.g. isearch)")
 '(which-key-show-transient-maps t)
 '(which-key-sort-order (quote which-key-local-then-key-order))
 '(which-key-sort-uppercase-first nil)

 '(which-key-local-map-description-face ((t (:inherit which-key-highlighted-command-face))))

;(global-set-key (kbd "<menu>") #'which-key-show-top-level) ; for beginners, but the default M-x equivalent is better for the experienced
(global-set-key "\C-cx" #'which-key-show-top-level)
(global-set-key "\C-cX" #'reserved) ; for a which-key command that is to #'which-key-show-top-level what #'which-key-show-full-keymap is to #'which-key-show-keymap

(define-prefix-command 'my/which-key-menus)
(global-set-key "\C-ck" 'my/which-key-menus)
(global-set-key "\C-ckm" #'which-key-show-major-mode)
(global-set-key "\C-ckM" #'which-key-show-minor-mode-keymap)
(global-set-key "\C-ckx" #'which-key-show-keymap)
(global-set-key "\C-ckX" #'which-key-show-full-keymap)

ScottFreeCode avatar Jan 16 '20 03:01 ScottFreeCode

I'm not sure why C-h d is affecting anything here. That's apropos-documentation for me (and default)

justbur avatar Jan 19 '20 19:01 justbur

I meant the toggle-docstrings action in the paging menu, C-h d while in a prefix.

ScottFreeCode avatar Jan 20 '20 16:01 ScottFreeCode

having trouble reproducing this. maybe it was fixed in recent changes?

justbur avatar Feb 12 '20 02:02 justbur