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. "Called in lieu of `delete-other-windows' in popup windows.
Raises WINDOW (assumed to be a popup), then deletes other 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)) (delete-other-windows window))
nil) nil)
@ -379,13 +379,13 @@ the message buffer in a popup window."
t) t)
;;;###autoload ;;;###autoload
(defun +popup/raise () (defun +popup/raise (window)
"Raise the current popup window into a regular window." "Raise the current popup window into a regular window."
(interactive) (interactive (list (selected-window)))
(unless (+popup-window-p) (cl-check-type window window)
(unless (+popup-window-p window)
(user-error "Cannot raise a non-popup window")) (user-error "Cannot raise a non-popup window"))
(let ((window (selected-window)) (let ((buffer (current-buffer))
(buffer (current-buffer))
+popup--remember-last) +popup--remember-last)
(set-window-parameter window 'ttl nil) (set-window-parameter window 'ttl nil)
(+popup/close window 'force) (+popup/close window 'force)