changeset 20968:7072722c5071

(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.
author Dave Love <fx@gnu.org>
date Wed, 25 Feb 1998 00:28:55 +0000
parents e57454838582
children 6007dc30ec3b
files lisp/winner.el
diffstat 1 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/winner.el	Tue Feb 24 12:54:05 1998 +0000
+++ b/lisp/winner.el	Wed Feb 25 00:28:55 1998 +0000
@@ -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 @@
 
 ;;; 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 @@
 
 (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"))