ui/popup: refactor +popup/raise

Improves its error tolerance and gives it a window argument.
This commit is contained in:
Henrik Lissner 2018-09-08 23:27:18 -04:00
parent da2a8b1063
commit 0b350f6ea4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -75,7 +75,7 @@ the buffer is visible, then set another timer and try again later."
"Called in lieu of `delete-other-windows' in popup windows.
Raises WINDOW (assumed to be a popup), then deletes other windows."
(when-let* ((window (+popup/raise)))
(when-let* ((window (+popup/raise window)))
(delete-other-windows window))
nil)
@ -379,13 +379,13 @@ the message buffer in a popup window."
t)
;;;###autoload
(defun +popup/raise ()
(defun +popup/raise (window)
"Raise the current popup window into a regular window."
(interactive)
(unless (+popup-window-p)
(interactive (list (selected-window)))
(cl-check-type window window)
(unless (+popup-window-p window)
(user-error "Cannot raise a non-popup window"))
(let ((window (selected-window))
(buffer (current-buffer))
(let ((buffer (current-buffer))
+popup--remember-last)
(set-window-parameter window 'ttl nil)
(+popup/close window 'force)