Refactor doom-popup-p
This commit is contained in:
parent
558a8d973c
commit
e6f892b115
1 changed files with 8 additions and 9 deletions
|
@ -4,16 +4,15 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-popup-p (&optional target)
|
(defun doom-popup-p (&optional target)
|
||||||
"Return TARGET (a window) if TARGET (a window or buffer) is a popup. Uses
|
"Return t if TARGET (a window or buffer) is a popup. Uses current window if
|
||||||
current window if omitted."
|
omitted."
|
||||||
(when-let (target (or target (selected-window)))
|
(when-let (target (or target (selected-window)))
|
||||||
(cond ((bufferp target)
|
(cond ((bufferp target)
|
||||||
(and (buffer-live-p target)
|
(and (buffer-local-value 'doom-popup-mode target)
|
||||||
(buffer-local-value 'doom-popup-mode target)))
|
(not (plist-get (buffer-local-value 'doom-popup-rules target) :fixed))))
|
||||||
((windowp target)
|
((windowp target)
|
||||||
(and (window-live-p target)
|
(and (window-parameter target 'popup)
|
||||||
(window-parameter target 'popup)
|
(not (doom-popup-property :fixed target)))))))
|
||||||
target)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-popup-buffer (buffer plist &optional extend-p)
|
(defun doom-popup-buffer (buffer plist &optional extend-p)
|
||||||
|
@ -103,8 +102,8 @@ Returns t if popups were restored, nil otherwise."
|
||||||
`selected-window'. The contained buffer is buried, unless it has an :autokill
|
`selected-window'. The contained buffer is buried, unless it has an :autokill
|
||||||
property."
|
property."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when-let (window (doom-popup-p window))
|
(when (doom-popup-p window)
|
||||||
(delete-window window)))
|
(delete-window (or window (selected-window)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/popup-close-all (&optional force-p)
|
(defun doom/popup-close-all (&optional force-p)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue