       (setf (alist-get 'window-parameters alist)
             parameters)
       alist)))
+
+;;;###autoload
+(defun +popup--init (window &optional alist)
+  "Initializes a popup window. Run any time a popup is opened. It sets the
+default window parameters for popup windows, clears leftover transient timers
+and enables `+popup-buffer-mode'."
+  (with-selected-window window
+    (setq alist (delq (assq 'actions alist) alist))
+    (when (and alist +popup--populate-wparams)
+      ;; Emacs 26+ will automatically map the window-parameters alist entry to
+      ;; the popup window, so we need this for Emacs 25.x users
+      (dolist (param (cdr (assq 'window-parameters alist)))
+        (set-window-parameter window (car param) (cdr param))))
+    (set-window-parameter window 'popup t)
+    (set-window-parameter window 'delete-window #'+popup--delete-window)
+    (set-window-parameter window 'delete-other-windows #'+popup--delete-other-windows)
+    (set-window-dedicated-p window 'popup)
+    (window-preserve-size
+     window (memq (window-parameter window 'window-side)
+                  '(left right))
+     t)
+    (+popup-buffer-mode +1)
+    (run-hooks '+popup-create-window-hook)))
 
 
 ;;

                         (run-at-time ttl nil #'+popup--kill-buffer
                                      buffer ttl))))))))))

(defun +popup--normalize-alist (alist)
  "Merge `+popup-default-alist' and `+popup-default-parameters' with ALIST."
  (when alist

                     (kill-process process))
                   (let (kill-buffer-hook kill-buffer-query-functions)
                     (kill-buffer buffer))))))))))

(defun +popup--delete-window (window)
  "Do housekeeping before destroying a popup window.
