feature/popup: reduce state in window parameters & fix popup continuity

+ Fix list where cons should be
+ Update +popup-window-parameters docstring
+ Use display-buffer instead of +popup-buffer (no need to remember
  alist). This ensures restored popups (with +popup/restore) are truly
  identical to their former selves.
This commit is contained in:
Henrik Lissner 2018-01-06 13:30:59 -05:00
parent 25ec2bdcbb
commit eef808d795
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 7 additions and 7 deletions

View file

@ -13,7 +13,7 @@
(cl-assert (cl-every #'windowp windows) t) (cl-assert (cl-every #'windowp windows) t)
(setq +popup--last (setq +popup--last
(cl-loop for w in windows (cl-loop for w in windows
collect (list (window-buffer w) collect (cons (window-buffer w)
(window-state-get w))))) (window-state-get w)))))
(defun +popup--kill-buffer (buffer ttl) (defun +popup--kill-buffer (buffer ttl)
@ -31,7 +31,7 @@ the buffer is visible, then set another timer and try again later."
(kill-process process)) (kill-process process))
(kill-buffer buffer))))) (kill-buffer buffer)))))
(defun +popup--init (window alist) (defun +popup--init (window)
"Initializes a popup window. Run any time a popup is opened. It sets the "Initializes a popup window. Run any time a popup is opened. It sets the
default window parameters for popup windows, clears leftover transient timers default window parameters for popup windows, clears leftover transient timers
and enables `+popup-buffer-mode'." and enables `+popup-buffer-mode'."
@ -110,7 +110,7 @@ current buffer."
(alist (+popup--normalize-alist alist)) (alist (+popup--normalize-alist alist))
(new-window (or (display-buffer-reuse-window buffer alist) (new-window (or (display-buffer-reuse-window buffer alist)
(display-buffer-in-side-window buffer alist)))) (display-buffer-in-side-window buffer alist))))
(+popup--init new-window alist) (+popup--init new-window)
(select-window (select-window
(if (+popup-parameter 'select new-window) (if (+popup-parameter 'select new-window)
new-window new-window
@ -281,7 +281,7 @@ the message buffer in a popup window."
(error "No popups to restore")) (error "No popups to restore"))
(cl-loop for (buffer . state) in +popup--last (cl-loop for (buffer . state) in +popup--last
if (and (buffer-live-p buffer) if (and (buffer-live-p buffer)
(+popup-buffer buffer)) (display-buffer buffer))
do (window-state-put state it)) do (window-state-put state it))
(setq +popup--last nil)) (setq +popup--last nil))

View file

@ -32,9 +32,9 @@ Modifying this has no effect, unless done before feature/popup loads.
CDR can be t (show the default modeline), a symbol representing the name of a CDR can be t (show the default modeline), a symbol representing the name of a
modeline defined with `def-modeline!', or nil (show no modeline). modeline defined with `def-modeline!', or nil (show no modeline).
(popup . BOOL) (popup . t)
If CDR is non-nil, this window is identified as a popup window. For internal This is for internal use, do not change this. It simply marks a window as a
use! Do not change this. popup window.
Since I can't find this information anywhere but the Emacs manual, I'll include Since I can't find this information anywhere but the Emacs manual, I'll include
a brief description of some native window parameters that Emacs uses: a brief description of some native window parameters that Emacs uses: