diff options
Diffstat (limited to 'lisp/winner.el')
-rw-r--r-- | lisp/winner.el | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/lisp/winner.el b/lisp/winner.el index 9506ac53bb2..8062fbae904 100644 --- a/lisp/winner.el +++ b/lisp/winner.el @@ -1,4 +1,4 @@ -;;; winner.el --- Restore old window configurations +;;; winner.el --- Restore old window configurations -*- lexical-binding: t -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. @@ -33,14 +33,13 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'ring) (defun winner-active-region () (declare (gv-setter (lambda (store) `(if ,store (activate-mark) (deactivate-mark))))) (region-active-p)) -(require 'ring) - (defgroup winner nil "Restoring window configurations." :group 'windows) @@ -273,7 +272,7 @@ You may want to include buffer names such as *Help*, *Apropos*, (let* ((buffers nil) (alive ;; Possibly update `winner-point-alist' - (cl-loop for buf in (mapcar 'cdr (cdr conf)) + (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) @@ -284,17 +283,8 @@ You may want to include buffer names such as *Help*, *Apropos*, ;; Restore points (dolist (win (winner-sorted-window-list)) (unless (and (pop alive) - (let* ((buf (window-buffer win)) - (pos (winner-get-point (window-buffer win) win)) - (entry (assq buf (window-prev-buffers win)))) - ;; Try to restore point of buffer in the selected - ;; window (Bug#23621). - (let ((marker (nth 2 entry))) - (when (and switch-to-buffer-preserve-window-point - marker - (not (= marker pos))) - (setq pos marker)) - (setf (window-point win) pos))) + (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 @@ -317,7 +307,7 @@ You may want to include buffer names such as *Help*, *Apropos*, ;; Return t if this is still a possible configuration. (or (null xwins) (progn - (mapc 'delete-window (cdr xwins)) ; delete all but one + (mapc #'delete-window (cdr xwins)) ; delete all but one (unless (one-window-p t) (delete-window (car xwins)) t)))))) @@ -328,22 +318,20 @@ You may want to include buffer names such as *Help*, *Apropos*, (defcustom winner-mode-hook nil "Functions to run whenever Winner mode is turned on or off." - :type 'hook - :group 'winner) + :type 'hook) (define-obsolete-variable-alias 'winner-mode-leave-hook 'winner-mode-off-hook "24.3") (defcustom winner-mode-off-hook nil "Functions to run whenever Winner mode is turned off." - :type 'hook - :group 'winner) + :type 'hook) (defvar winner-mode-map (let ((map (make-sparse-keymap))) (unless winner-dont-bind-my-keys - (define-key map [(control c) left] 'winner-undo) - (define-key map [(control c) right] 'winner-redo)) + (define-key map [(control c) left] #'winner-undo) + (define-key map [(control c) right] #'winner-redo)) map) "Keymap for Winner mode.") |