Function: which-key--show-buffer-side-window

which-key--show-buffer-side-window is a byte-compiled function defined in which-key.el.gz.

Signature

(which-key--show-buffer-side-window ACT-POPUP-DIM)

Documentation

Show which-key buffer when popup type is side-window.

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--show-buffer-side-window (act-popup-dim)
  "Show which-key buffer when popup type is side-window."
  (when (and which-key-preserve-window-configuration
             (not which-key--saved-window-configuration))
    (setq which-key--saved-window-configuration (current-window-configuration)))
  (let* ((height (car act-popup-dim))
         (width (cdr act-popup-dim))
         (alist
          (if which-key-allow-imprecise-window-fit
              `((window-width .  ,(which-key--text-width-to-total width))
                (window-height . ,height)
                (side . ,which-key-side-window-location)
                (slot . ,which-key-side-window-slot))
            `((window-width . which-key--fit-buffer-to-window-horizontally)
              (window-height . (lambda (w) (fit-window-to-buffer w nil 1)))
              (side . ,which-key-side-window-location)
              (slot . ,which-key-side-window-slot)))))
    (which-key--debug-message "Allow imprecise fit: %s
Display window alist: %s"
                              which-key-allow-imprecise-window-fit
                              alist)
    ;; Previously used `display-buffer-in-major-side-window' here, but
    ;; apparently that is meant to be an internal function. See emacs bug #24828
    ;; and advice given there.
    (cond
     ((eq which-key--multiple-locations t)
      ;; possibly want to switch sides in this case so we can't reuse the window
      (delete-windows-on which-key--buffer)
      (display-buffer-in-side-window which-key--buffer alist))
     ((get-buffer-window which-key--buffer)
      (display-buffer-reuse-window which-key--buffer alist))
     (t
      (display-buffer-in-side-window which-key--buffer alist)))))