1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-02 03:40:36 -08:00

Make default delay less aggressive.

Also avoids touching echo-keystrokes if it is already low.
This commit is contained in:
justbur 2015-07-07 15:00:10 -04:00
parent bfdae2557f
commit f122d3d42e

View file

@ -25,7 +25,7 @@
(require 'cl-extra)
(require 's)
(defvar which-key-idle-delay 0.6
(defvar which-key-idle-delay 1
"Delay (in seconds) for which-key buffer to popup.")
;; (defvar which-key-close-buffer-idle-delay 4
;; "Delay (in seconds) after which buffer is forced closed.")
@ -97,11 +97,14 @@ Used when `which-key-popup-type' is frame.")
(if which-key-mode
(progn
(unless which-key--setup-p (which-key/setup))
;; make echo-keytrokes fast for minibuffer popup
;; reduce echo-keytrokes for minibuffer popup
;; (it can interfer if it's too slow)
(when (and (> echo-keystrokes 0)
(eq which-key-popup-type 'minibuffer))
(setq echo-keystrokes 0.1))
(setq echo-keystrokes
(min echo-keystrokes (/ (float which-key-idle-delay) 2)))
(message "Which-key-mode enabled (note echo-keystrokes changed from %s to %s)"
which-key--echo-keystrokes-backup echo-keystrokes))
(add-hook 'pre-command-hook #'which-key/hide-popup)
(add-hook 'focus-out-hook #'which-key/stop-open-timer)
(add-hook 'focus-in-hook #'which-key/start-open-timer)