emacs-which-key
emacs-which-key copied to clipboard
Paging broken in which-key-show-keymap
"M-x", "which-key-show-keymap", select any keymap. "C-h n" displays:
f5 which-key-C-h-dispatch C-h which-key-C-h-dispatch
[
When which-key pops up automatically after a key is pressed, paging works normally.
I can't reproduce this. Can you give me all of your settings?
Ok, I'll check to ensure that I have the most recent version, try running without my current customization, and then follow-up by posting my settings.
Interesting. It does seem to be my customization file. If I do not load the file holding all packages' customization, the paging works as expected. Here is the file's contents:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(aw-keys (quote (97 115 100 102 103 104 106 107 108)))
'(comint-prompt-read-only t nil nil "Read-only prompt (\">\" in ess-R)")
'(comint-scroll-show-maximum-output t)
'(comint-scroll-to-bottom-on-input t)
'(comint-use-prompt-regexp nil nil nil "nil enables evil motions")
'(company-frontends
(quote
(company-pseudo-tooltip-unless-just-one-frontend company-preview-if-just-one-frontend)) nil nil "Rm company-echo-metadata-frontend to speed up candidate navigation")
'(company-global-modes (quote (ess-r-mode emacs-lisp-mode)))
'(company-idle-delay 0)
'(company-minimum-prefix-length 0.2 nil nil "Min # chars before completion")
'(company-show-numbers t nil nil "Use M-1, etc., to select candidates")
'(confirm-kill-processes nil)
'(counsel-bookmark-avoid-dired t)
'(counsel-mode t nil nil "Remap common commands to counsel commands")
'(custom-enabled-themes (quote (dracula)))
'(custom-safe-themes
(quote
("37f32706ffc6d7d021adf6b4d2a84eae7e0cfb7871cd39e21eaddc77c52bf4a7" "332fcf3c7208aca9fab65d54203f78a242482e7fd65f5725a2482c20b1730732" "35b0b0e531731e270708ddb342dc2e576a31fb298dcbc56a206596a43afac54f" "274fa62b00d732d093fc3f120aca1b31a6bb484492f31081c1814a858e25c72e" default)))
'(delete-by-moving-to-trash t)
'(eldoc-echo-area-use-multiline-p t nil nil "May not have an effect. Test on longer function signatures sometime.")
'(electric-layout-mode t nil nil "Compare behavior with and without in ess-R. Without this, newlines within {} or () inserts two newlines between them, indents the first and moves cursor to it. Setting this seems to interfere with that behavior, which is controlled by ess-roxy-newline-and-indent. This is because ess-r-mode sets electric-layout-rules to insert a newline after {, but doesn't enable electric-layout-mode. Must be an oversight. If setting this globally, disable it in R to keep the desired behavior. ")
'(electric-pair-mode t nil nil "Nice default behavior. Delete delimiter pair when deleting opening paren of empty pair (electric-pair-delete-adjacent-pairs). Skips over closing delim when you try to insert over an existing delim (electric-pair-skip-self). Inserts singles to preserve balance (electric-pair-preserve-balance). Insertion around active region, with point after whichever delim you typed--opening or closing. Example of cool defaults: In lisp comments, ` inserts `'.")
'(electric-pair-pairs (quote ((34 . 34) (8216 . 8217) (8220 . 8221) (123 . 125))))
'(ess-ask-for-ess-directory nil)
'(ess-eldoc-abbreviation-style (quote mild))
'(ess-eldoc-show-on-symbol t nil nil "Show function signature in echo area when inside function and on symbol. May not show until first argument has been completed.")
'(ess-eval-visibly nil)
'(ess-indent-with-fancy-comments nil nil nil "I suspect this is the reason comments were forced toward the right margin in R scripts")
'(ess-style (quote RStudio))
'(ess-use-company t)
'(evil-default-state (quote emacs))
'(evil-emacs-state-modes nil)
'(evil-escape-delay 0.2)
'(evil-escape-key-sequence "jk")
'(evil-highlight-closing-paren-at-point-states (quote (not emacs insert replace)) nil nil "Highlight closing paren at point in normal, before point in listed modes")
'(evil-insert-state-modes nil)
'(evil-intercept-maps nil)
'(evil-motion-state-modes nil nil nil "Read-only modes start in default mode (should be emacs)")
'(evil-overriding-maps nil)
'(evil-want-keybinding nil)
'(global-company-mode t)
'(global-display-line-numbers-mode t)
'(global-page-break-lines-mode t nil (page-break-lines))
'(hydra-hint-display-type (quote lv))
'(hydra-is-helpful nil nil nil "see which-key-show-transient-maps")
'(inhibit-startup-screen t)
'(ivy-count-format "%d/%d " nil nil "display index #/total for ivy completion")
'(ivy-extra-directories (quote ("../")))
'(ivy-height 10)
'(ivy-initial-inputs-alist nil)
'(ivy-mode t nil nil "Enable ivy completion")
'(ivy-use-virtual-buffers t)
'(menu-bar-mode nil)
'(package-selected-packages
(quote
(key-chord company projectile counsel hercules company-tabnine 0x0 flx evil-escape ranger pkg aggressive-indent ess-R-data-view ess which-key use-package quelpa page-break-lines hydra help-fns+ helm-descbinds general evil-tutor dracula-theme ffcounsel command-log-mode ace-window)))
'(recentf-max-saved-items 100 nil nil "Affects number of candidates with ivy-use-virtual-buffers?")
'(recentf-mode t)
'(scroll-bar-mode nil)
'(scroll-conservatively 1000000 nil nil "Seems to prevent auto-recentering of point when scrolling")
'(show-paren-highlight-openparen nil)
'(show-paren-mode t)
'(show-paren-style (quote parenthesis))
'(show-paren-when-point-in-periphery nil)
'(show-paren-when-point-inside-paren t)
'(tab-always-indent (quote complete))
'(tool-bar-mode nil)
'(use-package-verbose t)
'(which-key-allow-evil-operators t)
'(which-key-compute-remaps t nil nil "e.g. w/ counsel-mode: apropos-command -> counsel-apropos")
'(which-key-idle-delay 0.2)
'(which-key-max-description-length 100)
'(which-key-mode t)
'(which-key-popup-type (quote side-window))
'(which-key-prefix-prefix "+")
'(which-key-separator " ")
'(which-key-show-docstrings t)
'(which-key-show-operator-state-maps t)
'(which-key-show-transient-maps t)
'(which-key-side-window-location (quote bottom))
'(which-key-side-window-max-height 0.1)
'(which-key-sort-order (quote which-key-key-order-alpha))
'(which-key-sort-uppercase-first nil)
'(winner-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
It appears to be which-key-show-transient-maps
. When I set it to nil after loading my other settings, paging is restored.
This transient keymap seems to be how which-key injects the paging key, which is <f5>
by default.
Running into something similar: this transient map is also displayed for the top-level bindings (which-key-show-top-level) whether I customize the paging-key prefix list or not.
I think there are some bugs as to when the paging key is added, and transient maps set by which-key itself (or any transient map that still allows you to type other stuff) probably ought not cover up the rest of the bindings (maybe be merged into them?).
@ScottFreeCode which-key-show-transient-maps
is a mechanism for showing the key bindings in transient maps, which is distinct from the transient map used to do paging in the top level bindings. If you have a bug report, please open a new issue with more details.
[Hit "comment" prematurely before, sorry for double notification.]
It's the same bug, it just also affects which-key-show-top-level
.
which-key--show-page
sets a transient map which-key--get-popup-map
at https://github.com/justbur/emacs-which-key/blob/db3d003e903deb07394b4e572206f809578278c6/which-key.el#L2202-L2205 which is normally ignored by which-key--update
because the prefix key condition is satisfied first, but in which-key-show-top-level
and after paging in which-key-show-[full-]keymap
the (> (length prefix-keys) 0)
at https://github.com/justbur/emacs-which-key/blob/db3d003e903deb07394b4e572206f809578278c6/which-key.el#L2648 fails and so falls through to the transient map handling at https://github.com/justbur/emacs-which-key/blob/db3d003e903deb07394b4e572206f809578278c6/which-key.el#L2685-L2691
I tested this by commenting out the (> (length prefix-keys) 0)
and that fixes the issue here in both cases, but also causes some odd maps to pop up that shouldn't.
Tested and determined that saving the transient map from which-key--get-popup-map
in an internal variable and adding a check for whether overriding-terminal-local-map
equals that variable to which-key--update
:
https://github.com/justbur/emacs-which-key/blob/db3d003e903deb07394b4e572206f809578278c6/which-key.el#L2685-L2689
…fixes both cases without breaking transient maps created by things other than which-key (e.g. the isearch transient map).
please open a pr if you've found a fix