                       (or (and next-window
                                ;; Make new window before `next-window'.
                                (let ((next-side (if left-or-right 'above 'left))
+                                     (+popup--internal t)
                                      (window-combination-resize 'side))
                                  (setq window
                                        (ignore-errors (split-window next-window nil next-side)))))
                           (and prev-window
                                ;; Make new window after `prev-window'.
                                (let ((prev-side (if left-or-right 'below 'right))
+                                     (+popup--internal t)
                                      (window-combination-resize 'side))
                                  (setq window
                                        (ignore-errors (split-window prev-window nil prev-side))))))

;;; ui/popup/autoload/popup.el -*- lexical-binding: t; -*-

(defun +popup--remember (windows)
  "Remember WINDOWS (a list of windows) for later restoration."


(defun +popup--split-window (window size side)
  "Ensure a non-dedicated/popup window is selected when splitting a window."
  (unless +popup--internal
    (cl-loop for win
             in (cons (or window (selected-window))
                      (window-list nil 0 window))
             unless (+popup-window-p win)
             return (setq window win)))
  (let ((ignore-window-parameters t))
    (split-window window size side)))

