   (when +popup-mode
     (setq display-buffer-alist +popup--display-buffer-alist)))
 
+;;;###autoload
+(defun +popup|kill-buffer-hook ()
+  "TODO"
+  (let ((buf (current-buffer))
+        (+popup--inhibit-transient t))
+    (when (+popup-buffer-p buf)
+      (when-let* ((window (get-buffer-window buf)))
+        (when (+popup-window-p window)
+          (+popup--destroy window))))))
+
 
 ;;
 ;; Commands

  "Tries to kill BUFFER, as was requested by a transient timer. If it fails, eg.
the buffer is visible, then set another timer and try again later."
  (when (buffer-live-p buffer)
    (if (get-buffer-window buffer)
        (with-current-buffer buffer
          (setq +popup--timer
                (run-at-time ttl nil #'+popup--kill-buffer buffer ttl)))
      (with-demoted-errors "Error killing transient buffer: %s"
        (let ((inhibit-message (not doom-debug-mode)))
          (message "Cleaned up transient buffer: %s" buffer))
        (when-let* ((process (get-buffer-process (current-buffer))))
          (kill-process process))
        (kill-buffer buffer)))))

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

            (cl-assert (integerp ttl) t)
            (if (= ttl 0)
                (+popup--kill-buffer buffer 0)
              (add-hook 'kill-buffer-hook #'+popup|kill-buffer-hook nil t)
              (setq +popup--timer
                    (run-at-time ttl nil #'+popup--kill-buffer
                                 buffer ttl)))))))))
