doom-popup-prop => doom-popup-property
Also, new doom-popup-properties function.
This commit is contained in:
parent
65d758ce8f
commit
3dca6d8028
2 changed files with 17 additions and 11 deletions
|
@ -119,7 +119,7 @@ only close popups that have an :autoclose property in their rule (see
|
||||||
(dolist (window popups)
|
(dolist (window popups)
|
||||||
(when (or force-p
|
(when (or force-p
|
||||||
(called-interactively-p 'interactive)
|
(called-interactively-p 'interactive)
|
||||||
(doom-popup-prop :autoclose window))
|
(doom-popup-property :autoclose window))
|
||||||
(delete-window window)
|
(delete-window window)
|
||||||
(setq success t)))
|
(setq success t)))
|
||||||
success)))
|
success)))
|
||||||
|
@ -128,7 +128,7 @@ only close popups that have an :autoclose property in their rule (see
|
||||||
(defun doom/popup-close-maybe ()
|
(defun doom/popup-close-maybe ()
|
||||||
"Close the current popup *if* its window doesn't have a noesc parameter."
|
"Close the current popup *if* its window doesn't have a noesc parameter."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (doom-popup-prop :noesc)
|
(if (doom-popup-property :noesc)
|
||||||
(call-interactively
|
(call-interactively
|
||||||
(if (featurep 'evil)
|
(if (featurep 'evil)
|
||||||
#'evil-force-normal-state
|
#'evil-force-normal-state
|
||||||
|
@ -150,14 +150,20 @@ only close popups that have an :autoclose property in their rule (see
|
||||||
(doom-popup-buffer (get-buffer "*Messages*"))))
|
(doom-popup-buffer (get-buffer "*Messages*"))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-popup-prop (prop &optional window)
|
(defun doom-popup-properties (window-or-buffer)
|
||||||
|
"Returns a window's popup property list, if possible. The buffer-local
|
||||||
|
`doom-popup-rules' always takes priority, but this will fall back to the popup
|
||||||
|
window parameter."
|
||||||
|
(cond ((windowp window-or-buffer)
|
||||||
|
(or (doom-popup-properties (window-buffer window-or-buffer))
|
||||||
|
(window-parameter window 'popup)))
|
||||||
|
((bufferp window-or-buffer)
|
||||||
|
(buffer-local-value 'doom-popup-rules window-or-buffer))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom-popup-property (prop &optional window)
|
||||||
"Returns a `doom-popup-rules' PROPerty from WINDOW."
|
"Returns a `doom-popup-rules' PROPerty from WINDOW."
|
||||||
(or (plist-get (or (if window
|
(or (plist-get (doom-popup-properties (or window (selected-window)))
|
||||||
(ignore-errors
|
|
||||||
(buffer-local-value 'doom-popup-rules
|
|
||||||
(window-buffer window)))
|
|
||||||
doom-popup-rules)
|
|
||||||
(window-parameter window 'popup))
|
|
||||||
prop)
|
prop)
|
||||||
(pcase prop
|
(pcase prop
|
||||||
(:size shackle-default-size)
|
(:size shackle-default-size)
|
||||||
|
@ -166,7 +172,7 @@ only close popups that have an :autoclose property in their rule (see
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-popup-side (&optional window)
|
(defun doom-popup-side (&optional window)
|
||||||
"Return what side a popup WINDOW came from ('left 'right 'above or 'below)."
|
"Return what side a popup WINDOW came from ('left 'right 'above or 'below)."
|
||||||
(let ((align (doom-popup-prop :align window)))
|
(let ((align (doom-popup-property :align window)))
|
||||||
(when (eq align t)
|
(when (eq align t)
|
||||||
(setq align shackle-default-alignment))
|
(setq align shackle-default-alignment))
|
||||||
(when (functionp align)
|
(when (functionp align)
|
||||||
|
|
|
@ -330,7 +330,7 @@ properties."
|
||||||
"If current window is a popup, close it. If minibuffer is open, close it. If
|
"If current window is a popup, close it. If minibuffer is open, close it. If
|
||||||
not in a popup, close all popups with an :autoclose property."
|
not in a popup, close all popups with an :autoclose property."
|
||||||
(cond ((doom-popup-p)
|
(cond ((doom-popup-p)
|
||||||
(unless (doom-popup-prop :noesc)
|
(unless (doom-popup-property :noesc)
|
||||||
(delete-window)))
|
(delete-window)))
|
||||||
(t
|
(t
|
||||||
(doom/popup-close-all))))
|
(doom/popup-close-all))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue