feature/popup: minor refactor

This commit is contained in:
Henrik Lissner 2018-01-07 18:39:42 -05:00
parent 5a420faa0f
commit 031e31c03c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -224,8 +224,7 @@ disabled."
(not modeline)) (not modeline))
(doom-hide-modeline-mode +1)) (doom-hide-modeline-mode +1))
((symbolp modeline) ((symbolp modeline)
(setq doom--modeline-format (doom-modeline modeline)) (when-let* ((doom--modeline-format (doom-modeline modeline)))
(when doom--modeline-format
(doom-hide-modeline-mode +1))))) (doom-hide-modeline-mode +1)))))
(when doom-hide-modeline-mode (when doom-hide-modeline-mode
(doom-hide-modeline-mode -1)))) (doom-hide-modeline-mode -1))))
@ -235,10 +234,9 @@ disabled."
"If called inside a popup, try to close that popup window (see "If called inside a popup, try to close that popup window (see
`+popup/close'). If called outside, try to close all popup windows (see `+popup/close'). If called outside, try to close all popup windows (see
`+popup/close-all')." `+popup/close-all')."
(call-interactively (if (+popup-p)
(if (+popup-p) (+popup/close)
#'+popup/close (+popup/close-all)))
#'+popup/close-all)))
;;;###autoload ;;;###autoload
(defun +popup|cleanup-rules () (defun +popup|cleanup-rules ()
@ -315,10 +313,11 @@ This window parameter is ignored if FORCE-P is non-nil."
"If popups are open, close them. If they aren't, restore the last one or open "If popups are open, close them. If they aren't, restore the last one or open
the message buffer in a popup window." the message buffer in a popup window."
(interactive) (interactive)
(cond ((+popup-windows) (let ((+popup--inhibit-transient t))
(+popup/close-all t)) (cond ((+popup-windows)
((ignore-errors (+popup/restore))) (+popup/close-all t))
((display-buffer (get-buffer "*Messages*"))))) ((ignore-errors (+popup/restore)))
((display-buffer (get-buffer "*Messages*"))))))
;;;###autoload ;;;###autoload
(defun +popup/restore () (defun +popup/restore ()