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
1 changed files with 9 additions and 8 deletions

View File

@ -175,7 +175,8 @@ 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)))
(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