summaryrefslogtreecommitdiff
path: root/lisp/winner.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>1998-02-25 00:28:55 +0000
committerDave Love <fx@gnu.org>1998-02-25 00:28:55 +0000
commit3b3712f9607fcd3d5a6b638e38cf8ba4fe510655 (patch)
tree2887f4442b9580ee04c4f1177c79b29f9645c34a /lisp/winner.el
parentb8ee857526305a390091df7a59665b13efd15421 (diff)
downloademacs-3b3712f9607fcd3d5a6b638e38cf8ba4fe510655.tar.gz
(require 'cl) unconditionally.
(winner): defgroup. (winner-dont-bind-my-keys, winner-skip-buffers, winner-skip-regexps, winner-mode, winner-mode-hook, winner-mode-leave-hook); Customized. (winner-mode): Add autoload cookie. (winner-undo): Doc fix.
Diffstat (limited to 'lisp/winner.el')
-rw-r--r--lisp/winner.el51
1 files changed, 38 insertions, 13 deletions
diff --git a/lisp/winner.el b/lisp/winner.el
index 752b3f5b4a3..1ddad8a10b0 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -1,6 +1,6 @@
;;; winner.el --- Restore window configuration (or switch buffer)
-;; Copyright (C) 1997 Free Software Foundation. Inc.
+;; Copyright (C) 1997, 1998 Free Software Foundation. Inc.
;; Author: Ivar Rummelhoff <ivarr@ifi.uio.no>
;; Maintainer: Ivar Rummelhoff <ivarr@ifi.uio.no>
@@ -45,29 +45,49 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl)
(require 'ring)
-(defvar winner-dont-bind-my-keys nil
- "If non-nil: Do not use `winner-mode-map' in Winner mode.")
+(defgroup winner nil
+ "Restoring window configurations."
+ :group 'windows)
+
+(defcustom winner-mode nil
+ "Toggle winner-mode.
+You must modify via \\[customize] for this variable to have an effect."
+ :set (lambda (symbol value)
+ (winner-mode (or value 0)))
+ :initialize 'custom-initialize-default
+ :type 'boolean
+ :group 'winner
+ :require 'winner)
+
+(defcustom winner-dont-bind-my-keys nil
+ "If non-nil: Do not use `winner-mode-map' in Winner mode."
+ :type 'boolean
+ :group 'winner)
(defvar winner-ring-size 100
"Maximum number of stored window configurations per frame.")
-(defvar winner-skip-buffers
+(defcustom winner-skip-buffers
'("*Messages*",
"*Compile-Log*",
".newsrc-dribble",
"*Completions*",
"*Buffer list*")
- "Exclude these buffer names from any \(Winner switch\) list of buffers.")
+ "Exclude these buffer names from any \(Winner switch\) list of buffers."
+ :type '(repeat string)
+ :group 'winner)
-(defvar winner-skip-regexps '("^ ")
+(defcustom winner-skip-regexps '("^ ")
"Winner excludes buffers with names matching any of these regexps.
They are not included in any Winner mode list of buffers.
By default `winner-skip-regexps' is set to \(\"^ \"\),
-which excludes \"invisible buffers\".")
+which excludes \"invisible buffers\"."
+ :type '(repeat regexp)
+ :group 'winner)
(defvar winner-ring-alist nil)
@@ -98,15 +118,19 @@ which excludes \"invisible buffers\".")
;;; Winner mode (a minor mode)
-(defvar winner-mode-hook nil
- "Functions to run whenever Winner mode is turned on.")
+(defcustom winner-mode-hook nil
+ "Functions to run whenever Winner mode is turned on."
+ :type 'hook
+ :group winner)
(defvar winner-mode-leave-hook nil
- "Functions to run whenever Winner mode is turned off.")
+ "Functions to run whenever Winner mode is turned off."
+ :type 'hook
+ :group winner)
-(defvar winner-mode nil) ; mode variable
(defvar winner-mode-map nil "Keymap for Winner mode.")
+;;;###autoload
(defun winner-mode (&optional arg)
"Toggle Winner mode.
With arg, turn Winner mode on if and only if arg is positive."
@@ -136,7 +160,8 @@ With arg, turn Winner mode on if and only if arg is positive."
(defun winner-undo (arg)
"Switch back to an earlier window configuration saved by Winner mode.
-In other words, \"undo\" changes in window configuration."
+In other words, \"undo\" changes in window configuration.
+With prefix arg, undo that many levels."
(interactive "p")
(cond
((not winner-mode) (error "Winner mode is turned off"))