doom-popup-p: return window if popup

This commit is contained in:
Henrik Lissner 2017-03-01 22:12:30 -05:00
parent 64a60a1501
commit 8fa6ba7886

View file

@ -3,13 +3,15 @@
;;;###autoload ;;;###autoload
(defun doom-popup-p (&optional target) (defun doom-popup-p (&optional target)
"Return t if TARGET (a window or buffer) is a popup. Uses current window if "Return TARGET (a window) if TARGET (a window or buffer) is a popup. Uses
omitted." current window if omitted."
(when-let (target (or target (selected-window))) (when-let (target (or target (selected-window)))
(cond ((bufferp target) (cond ((bufferp target)
(buffer-local-value 'doom-popup-mode target)) (and (buffer-local-value 'doom-popup-mode target)
(get-buffer-window target)))
((windowp target) ((windowp target)
(window-parameter target 'popup))))) (and (window-parameter target 'popup)
target)))))
;;;###autoload ;;;###autoload
(defun doom-popup-buffer (buffer &rest plist) (defun doom-popup-buffer (buffer &rest plist)