Don’t err in pip-frame-remove-buffer if there is no PIP frame

This is useful e.g. to prevent the error when a PIP frame with a
temporarily displayed buffer is deleted before the buffer timer
attempts to remove the buffer.
This commit is contained in:
Milan Zamazal 2022-08-02 21:14:04 +02:00
parent e8b16420f8
commit 8c396a11f5

View File

@ -175,14 +175,15 @@ If the buffer is not present in the PIP frame, do nothing."
(interactive (list (completing-read "Remove PIP buffer: "
(mapcar #'buffer-name (pip-frame--buffers))
nil t)))
(let* ((windows (window-list (pip-frame--get-frame)))
(buffer (get-buffer buffer-or-name))
(windows-to-delete (cl-remove buffer windows
:key #'window-buffer
:test-not #'eq)))
(if (= (length windows-to-delete) (length windows))
(pip-frame-delete-frame)
(seq-do #'delete-window windows-to-delete))))
(if-let ((frame (pip-frame--get-frame t))
(windows (window-list frame))
(buffer (get-buffer buffer-or-name))
(windows-to-delete (cl-remove buffer windows
:key #'window-buffer
:test-not #'eq)))
(if (= (length windows-to-delete) (length windows))
(pip-frame-delete-frame)
(seq-do #'delete-window windows-to-delete))))
(defun pip-frame--move (x y)
(let ((frame (pip-frame--get-frame)))