 ;;;###autoload
 (defun +popup-buffer (buffer &optional alist)
   "Open BUFFER in a popup window. ALIST describes its features."
-  (let* ((origin (selected-window))
-         (window-min-height 3)
+  (let* ((window-min-height 3)
          (alist (+popup--normalize-alist alist))
          (actions (or (cdr (assq 'actions alist))
                       +popup-default-display-buffer-actions)))

               (alist (remove (assq 'window-height alist) alist))
               (window (display-buffer-reuse-window buffer alist)))
          (when window
            (unless +popup--inhibit-select
              (let ((select (+popup-parameter 'select window)))
              (if (functionp select)
                  (funcall select window origin)
                (select-window (if select window origin)))))
            window))
        (when-let (popup (cl-loop for func in actions
                                  if (funcall func buffer alist)
                                  return it))
          (+popup--init popup alist)
          (unless +popup--inhibit-select
            (let ((select (+popup-parameter 'select popup)))
              (if (functionp select)
                  (funcall select popup origin)
                (select-window (if select popup origin)))))
          popup))))

;;;###autoload

  (let ((ignore-window-parameters t))
    (split-window window size side)))

(defun +popup--maybe-select-window (window)
  "Select a window based on `+popup--inhibit-select' and this window's `select' parameter."
  (unless +popup--inhibit-select
    (let ((origin (selected-window))
          (select (+popup-parameter 'select window)))
      (if (functionp select)
          (funcall select window origin)
        (select-window (if select window origin))))))

;;;###autoload
(defun +popup--init (window &optional alist)
  "Initializes a popup window. Run any time a popup is opened. It sets the
