Function: winner-mode

winner-mode is an autoloaded, interactive and byte-compiled function defined in winner.el.gz.

Signature

(winner-mode &optional ARG)

Documentation

Toggle Winner mode on or off.

Winner mode is a global minor mode that records the changes in the window configuration (i.e. how the frames are partitioned into windows) so that the changes can be "undone" using the command winner-undo. By default this one is bound to the key sequence \C-c <left>. If you change your mind (while undoing), you can press \C-c <right> (calling winner-redo).

This is a global minor mode. If called interactively, toggle the Winner mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=winner-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 20.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/winner.el.gz
;;;###autoload
(define-minor-mode winner-mode
  "Toggle Winner mode on or off.

Winner mode is a global minor mode that records the changes in
the window configuration (i.e. how the frames are partitioned
into windows) so that the changes can be \"undone\" using the
command `winner-undo'.  By default this one is bound to the key
sequence \\`C-c <left>'.  If you change your mind (while undoing),
you can press \\`C-c <right>' (calling `winner-redo')."
  :global t
  (if winner-mode
      (progn
        (add-hook 'window-configuration-change-hook 'winner-change-fun)
        (add-hook 'post-command-hook 'winner-save-old-configurations)
        (add-hook 'minibuffer-setup-hook 'winner-save-unconditionally)
        (setq winner-modified-list (frame-list))
        (winner-save-old-configurations))
    (remove-hook 'window-configuration-change-hook 'winner-change-fun)
    (remove-hook 'post-command-hook 'winner-save-old-configurations)
    (remove-hook 'minibuffer-setup-hook 'winner-save-unconditionally)))