[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/which-key c87b0ce 02/51: Add debugging messages for buf
From: |
Stefan Monnier |
Subject: |
[elpa] externals/which-key c87b0ce 02/51: Add debugging messages for buffer sizing |
Date: |
Tue, 8 Sep 2020 10:26:14 -0400 (EDT) |
branch: externals/which-key
commit c87b0ce78213f922a725be1e0ae2dede1cf29516
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>
Add debugging messages for buffer sizing
---
which-key.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/which-key.el b/which-key.el
index 08f259d..2aeaeaa 100644
--- a/which-key.el
+++ b/which-key.el
@@ -640,12 +640,13 @@ used.")
(defvar which-key--automatic-display nil
"Internal: Non-nil if popup was triggered with automatic
update.")
+(defvar which-key--debug-buffer-name nil
+ "If non-nil, use this buffer for debug messages.")
(defvar which-key--multiple-locations nil)
(defvar which-key--inhibit-next-operator-popup nil)
(defvar which-key--prior-show-keymap-args nil)
(defvar which-key--previous-frame-size nil)
(defvar which-key--prefix-title-alist nil)
-(defvar which-key--debug nil)
(defvar which-key--evil-keys-regexp (eval-when-compile
(regexp-opt '("-state"))))
(defvar which-key--ignore-non-evil-keys-regexp
@@ -701,6 +702,14 @@ update.")
(when which-key--pages-obj
(which-key--pages-prefix which-key--pages-obj)))
+(defmacro which-key--debug-message (&rest msg)
+ `(when which-key--debug-buffer-name
+ (let ((buf (get-buffer-create which-key--debug-buffer-name))
+ (fmt-msg (format ,@msg)))
+ (with-current-buffer buf
+ (goto-char (point-max))
+ (insert "\n" fmt-msg "\n")))))
+
;;; Third-party library support
;;;; Evil
@@ -1919,7 +1928,7 @@ as well as metadata."
(push page-width page-widths))
(make-which-key--pages
:pages (nreverse pages)
- :height avl-lines
+ :height (if (> n-pages 1) avl-lines (min avl-lines n-keys))
:widths (nreverse page-widths)
:keys/page (reverse keys/page)
:page-nums (number-sequence 1 n-pages)
@@ -1981,6 +1990,12 @@ is the width of the live window."
(or prefix-title
(which-key--maybe-get-prefix-title
(key-description prefix-keys))))
+ (which-key--debug-message "Frame height: %s
+Minibuffer height: %s
+Max dimensions: (%s,%s)
+Available for bindings: (%s,%s)
+Actual lines: %s" (frame-height) (window-text-height (minibuffer-window))
+max-lines max-width avl-lines avl-width (which-key--pages-height result))
result)))
(defun which-key--lighter-status ()
@@ -2495,7 +2510,7 @@ is selected interactively by mode in
`minor-mode-map-alist'."
(&optional prefix-keys from-keymap filter prefix-title)
"Fill `which-key--buffer' with key descriptions and reformat.
Finally, show the buffer."
- (let ((start-time (when which-key--debug (current-time)))
+ (let ((start-time (current-time))
(formatted-keys (which-key--get-bindings
prefix-keys from-keymap filter))
(prefix-desc (key-description prefix-keys)))
@@ -2510,9 +2525,9 @@ Finally, show the buffer."
(which-key--create-pages
formatted-keys prefix-keys prefix-title))
(which-key--show-page)))
- (when which-key--debug
- (message "On prefix \"%s\" which-key took %.0f ms." prefix-desc
- (* 1000 (float-time (time-since start-time)))))))
+ (which-key--debug-message
+ "On prefix \"%s\" which-key took %.0f ms." prefix-desc
+ (* 1000 (float-time (time-since start-time))))))
(defun which-key--this-command-keys ()
"Version of `this-single-command-keys' corrected for key-chords and
god-mode."
- [elpa] externals/which-key updated (9c5922e -> d794c4a), Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 187ac0e 03/51: Add note to docstring for which-key-idle-delay, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key c87b0ce 02/51: Add debugging messages for buffer sizing,
Stefan Monnier <=
- [elpa] externals/which-key da2e093 08/51: Add no-paging optional arg to which-key-show-keymap, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 51c485f 01/51: Don't ignore case when making replacements, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 77586e6 04/51: Add which-key-dump-bindings, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 5cbfccd 09/51: Add which-key-manual-update, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key fb2bc8f 06/51: Add which-key-persistent-popup-p variable (#213), Stefan Monnier, 2020/09/08
- [elpa] externals/which-key ba03e7e 05/51: Add translation keymap support (#210), Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 2cb5ceb 12/51: Fix paging in which-key-manual-update, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key a256c4b 13/51: Use which-key-idle-secondary-delay value in manual updates, Stefan Monnier, 2020/09/08
- [elpa] externals/which-key a916c9a 15/51: Fix typos (#222), Stefan Monnier, 2020/09/08
- [elpa] externals/which-key 45bfcd3 22/51: Make which-key-show prefix mode-line work like top and bottom, Stefan Monnier, 2020/09/08