 
 ;;;###autoload
 (defun doom-popup-switch-to-buffer (buffer)
+  "Switch the current (or closest) pop-up window to BUFFER."
   (unless (doom-popup-p)
     (let ((popups (doom-popup-windows)))
       (unless popups

only close popups that have an :autoclose property in their rule (see
`shackle-rules')."
  (interactive)
  (let ((orig-win (selected-window)))
    (when-let (popups (doom-popup-windows))
      (setq doom-popup-history (mapcar #'doom--popup-data popups))
      (let (doom-popup-remember-history)
        (dolist (window popups)
          (let ((rules (window-parameter window 'popup)))
            (when (or force-p
                      (called-interactively-p 'interactive)
                      (and (plist-member rules :autoclose)
                           (plist-get rules :autoclose)))
              (delete-window window))))))))

;;;###autoload
(defun doom/popup-close-maybe ()
  "Close the current popup *if* its window doesn't have a noesc parameter."
  (interactive)
  (let ((window (selected-window)))
    (if (plist-get doom-popup-rules :noesc)
        (call-interactively (if (featurep 'evil)
                                #'evil-force-normal-state
                              #'keyboard-escape-quit))
      (delete-window window))))

;;;###autoload
(defun doom/popup ()
  "Display currently selected buffer in a popup window."
  (interactive)
  (doom-popup-buffer (current-buffer) :align t :autokill t))

(defun doom--popup-data (window)
  (let ((buffer (window-buffer window)))
    (when buffer
      `(,(buffer-name buffer)
        :file  ,(buffer-file-name buffer)
        :rules ,(window-parameter window 'popup)))))

;;;###autoload
(defun doom/popup-toggle-messages ()

    (dolist (spec doom-popup-history)
      (let ((buffer (get-buffer (car spec)))
            (file   (plist-get (cdr spec) :file))
            (rules  (plist-get (cdr spec) :rules))
            (size   (plist-get (cdr spec) :size)))
        (when (and (not buffer) file)
          (setq buffer
                (if-let (buf (get-file-buffer file))
                    (clone-indirect-buffer (buffer-name buf) nil t)
                  (find-file-noselect file t))))
        (when size
          (setq rules (plist-put rules :size size)))
        (when (and buffer (apply #'doom-popup-buffer buffer rules) (not any-p))
          (setq any-p t))))
    (when any-p
