Function: winner-set
winner-set is a byte-compiled function defined in winner.el.gz.
Signature
(winner-set CONF)
Source Code
;; Defined in /usr/src/emacs/lisp/winner.el.gz
;; Make sure point does not end up in the minibuffer and delete
;; windows displaying dead or boring buffers
;; (cf. `winner-boring-buffers') and `winner-boring-buffers-regexp'.
;; Return nil if all the windows should be deleted. Preserve correct
;; points and marks.
(defun winner-set (conf)
;; For the format of `conf', see `winner-conf'.
(let* ((buffers nil)
(alive
;; Possibly update `winner-point-alist'
(cl-loop for buf in (mapcar #'cdr (cdr conf))
for pos = (winner-get-point buf nil)
if (and pos (not (memq buf buffers)))
do (push buf buffers)
collect pos)))
(winner-set-conf (car conf))
(let (xwins) ; to be deleted
;; Restore points
(dolist (win (winner-sorted-window-list))
(unless (and (pop alive)
(setf (window-point win)
(winner-get-point (window-buffer win) win))
(not (or (member (buffer-name (window-buffer win))
winner-boring-buffers)
(and winner-boring-buffers-regexp
(string-match
winner-boring-buffers-regexp
(buffer-name (window-buffer win)))))))
(push win xwins))) ; delete this window
;; Restore marks
;; `winner-undo' shouldn't update the selection (Bug#28631) when
;; select-enable-primary is non-nil.
(unless select-enable-primary
(save-current-buffer
(cl-loop for buf in buffers
for entry = (cadr (assq buf winner-point-alist))
do (progn (set-buffer buf)
(set-mark (car entry))
(setf (winner-active-region) (cdr entry))))))
;; Delete windows, whose buffers are dead or boring.
;; Return t if this is still a possible configuration.
(or (null xwins)
(progn
(mapc #'delete-window (cdr xwins)) ; delete all but one
(unless (one-window-p t)
(delete-window (car xwins))
t))))))