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

Imprecise fit + prefix in modeline covers bottom row

Open ScottFreeCode opened this issue 4 years ago • 8 comments

I recently was experimenting with the transient buffer setting and discovered it can show the isearch keys, (which is really cool!); however, I discovered it clobbers the echo area for isearch, so I switched the prefix display to the modeline.

This led to the discovery that the modeline used for which-key display of the prefix covers the last row of keys, unless I turn off imprecise window fit.

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 02:01 ScottFreeCode

Speaking of transient maps see also https://github.com/justbur/emacs-which-key/issues/223#issuecomment-573990931

ScottFreeCode avatar Jan 16 '20 03:01 ScottFreeCode

By the way, thanks for making which-key! I recommend it to everyone I suggest trying Emacs; in fact, while I could survive without it now, I probably wouldn't have learned Emacs without it!

ScottFreeCode avatar Jan 16 '20 04:01 ScottFreeCode

I also have the same issue. Using Emacs 26.3, doom-modeline and the latest which-key with default settings.

MunsterPlop avatar Apr 14 '20 21:04 MunsterPlop

Can I have some steps to reproduce this?

I've also been thinking for a while that the "imprecise" fit method should just be the default.

justbur avatar May 04 '20 15:05 justbur

I also experience this issue when using doom-emacs with which-key. I am not able to reproduce it when just loading which-key and doom-modeline. Unfortunately I have to enable this option as otherwise emacs crashes (as described in #130).

zwass avatar May 12 '20 02:05 zwass

@justbur do you have an idea of how I can add a newline after the which-key buffer contents so that I can see the last row of text? I'd prefer to do that and potentially have a slightly bigger buffer than to miss that last line.

zwass avatar May 12 '20 16:05 zwass

I added the following to my config file which adds an additional line to the height of the which-key window and it seems to be a reasonable workaround for this:

;; Add an extra line to work around bug in which-key imprecise
(defun add-which-key-line (f &rest r) (progn (apply f (list (cons (+ 1 (car (car r))) (cdr (car r)))))))
(advice-add 'which-key--show-popup :around #'add-which-key-line)

My elisp-fu is lacking, so would appreciate any better strategy.

zwass avatar May 12 '20 18:05 zwass

I can report the same issue.

doolio avatar Dec 23 '20 17:12 doolio