Function: which-key--create-pages
which-key--create-pages is a byte-compiled function defined in
which-key.el.gz.
Signature
(which-key--create-pages KEYS &optional PREFIX-KEYS PREFIX-TITLE)
Documentation
Create page strings using which-key--list-to-pages.
Will try to find the best number of rows and columns using the given dimensions and the length and widths of KEYS. SEL-WIN-WIDTH is the width of the live window.
Source Code
;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--create-pages (keys &optional prefix-keys prefix-title)
"Create page strings using `which-key--list-to-pages'.
Will try to find the best number of rows and columns using the
given dimensions and the length and widths of KEYS. SEL-WIN-WIDTH
is the width of the live window."
(let* ((max-dims (which-key--popup-max-dimensions))
(max-lines (car max-dims))
(max-width (cdr max-dims))
(prefix-desc (key-description prefix-keys))
(full-prefix (which-key--full-prefix prefix-desc))
(prefix (when (eq which-key-show-prefix 'left)
(+ 2 (which-key--string-width full-prefix))))
(prefix-top-bottom (member which-key-show-prefix '(bottom top)))
(avl-lines (if prefix-top-bottom (- max-lines 1) max-lines))
(min-lines (min avl-lines which-key-min-display-lines))
(avl-width (if prefix (- max-width prefix) max-width))
(vertical (or (and (eq which-key-popup-type 'side-window)
(member which-key-side-window-location '(left right)))
(eq which-key-max-display-columns 1)))
result)
(setq result
(which-key--create-pages-1
keys avl-lines avl-width min-lines vertical))
(when (and result
(> (which-key--pages-num-pages result) 0))
(setf (which-key--pages-prefix result) prefix-keys)
(setf (which-key--pages-prefix-title result)
(or prefix-title
(which-key--maybe-get-prefix-title
(key-description prefix-keys))))
(when prefix-top-bottom
;; Add back the line earlier reserved for the page information.
(setf (which-key--pages-height result) max-lines))
(when (and (= (which-key--pages-num-pages result) 1)
(> which-key-min-display-lines
(which-key--pages-height result)))
;; result is shorter than requested, so we artificially increase the
;; height. See #325. Note this only has an effect if
;; `which-key-allow-imprecise-window-fit' is non-nil.
(setf (which-key--pages-height result) which-key-min-display-lines))
(which-key--debug-message "Frame height: %s
Frame pixel width: %s
Frame char width: %s
Frame width: %s
Which-key initial width: %s
Which-key adjusted width: %s
Minibuffer height: %s
Max dimensions: (%s, %s)
Available for bindings: (%s, %s)
Popup type info: (%s, %s, %s)
Computed page widths: %s
Actual lines: %s"
(frame-height)
(frame-pixel-width)
(frame-char-width)
(window-total-width (frame-root-window))
(which-key--width-or-percentage-to-width
which-key-side-window-max-width)
(which-key--total-width-to-text
(which-key--width-or-percentage-to-width
which-key-side-window-max-width))
(window-text-height (minibuffer-window))
max-lines
max-width
avl-lines
avl-width
which-key-popup-type
which-key-side-window-location
which-key-side-window-max-width
(which-key--pages-widths result)
(which-key--pages-height result))
result)))