changeset 20800:43c77517a76c

(type-break-mode): New customize variable to automatically load the package. Other variables customized.
author Stephen Eglen <stephen@gnu.org>
date Thu, 29 Jan 1998 09:26:38 +0000
parents e244bb966970
children 8aeddd528f57
files lisp/type-break.el
diffstat 1 files changed, 64 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/type-break.el	Thu Jan 29 09:10:09 1998 +0000
+++ b/lisp/type-break.el	Thu Jan 29 09:26:38 1998 +0000
@@ -8,7 +8,7 @@
 ;; Status: Works in GNU Emacs 19.25 or later, some versions of XEmacs
 ;; Created: 1994-07-13
 
-;; $Id$
+;; $Id: type-break.el,v 1.12 1997/06/23 05:28:51 friedman Exp stephen $
 
 ;; This file is part of GNU Emacs.
 
@@ -69,17 +69,31 @@
 ;;; Code:
 
 
-;;;###autoload
-(defvar type-break-mode nil
-  "*Non-`nil' means typing break mode is enabled.
-See the docstring for the `type-break-mode' command for more information.")
+(defgroup type-break nil
+  "Encourage the user to take a rest from typing at suitable intervals."
+  :prefix "type-break"
+  :group 'keyboard)
 
 ;;;###autoload
-(defvar type-break-interval (* 60 60)
-  "*Number of seconds between scheduled typing breaks.")
+(defcustom type-break-mode nil
+  "*Non-`nil' means typing break mode is enabled.
+See the docstring for the `type-break-mode' command for more information.
+You must modify via \\[customize] for this variable to have an effect."
+  :set (lambda (symbol value)
+	 (type-break-mode (if value 1 -1)))
+  :initialize 'custom-initialize-default  
+  :type 'boolean
+  :group 'type-break
+  :require 'type-break)
 
 ;;;###autoload
-(defvar type-break-good-rest-interval (/ type-break-interval 6)
+(defcustom type-break-interval (* 60 60)
+  "*Number of seconds between scheduled typing breaks."
+  :type 'integer
+  :group 'type-break)
+
+;;;###autoload
+(defcustom type-break-good-rest-interval (/ type-break-interval 6)
   "*Number of seconds of idle time considered to be an adequate typing rest.
 
 When this variable is non-`nil', emacs checks the idle time between
@@ -87,10 +101,12 @@
 rest from typing, then the next typing break is simply rescheduled for later.
 
 If a break is interrupted before this much time elapses, the user will be
-asked whether or not really to interrupt the break.")
+asked whether or not really to interrupt the break."
+  :type 'integer
+  :group 'type-break)
 
 ;;;###autoload
-(defvar type-break-keystroke-threshold
+(defcustom type-break-keystroke-threshold
   ;; Assuming typing speed is 35wpm (on the average, do you really
   ;; type more than that in a minute?  I spend a lot of time reading mail
   ;; and simply studying code in buffers) and average word length is
@@ -105,7 +121,7 @@
          (lower (/ upper 5)))
     (cons lower upper))
   "*Upper and lower bound on number of keystrokes for considering typing break.
-This structure is a pair of numbers.
+This structure is a pair of numbers (MIN . MAX).
 
 The first number is the minimum number of keystrokes that must have been
 entered since the last typing break before considering another one, even if
@@ -123,12 +139,16 @@
 keystroke even though they really require multiple keys to generate them.
 
 The command `type-break-guesstimate-keystroke-threshold' can be used to
-guess a reasonably good pair of values for this variable.")
+guess a reasonably good pair of values for this variable."
+  :type 'sexp
+  :group 'type-break)
 
-(defvar type-break-query-mode t
+(defcustom type-break-query-mode t
   "*Non-`nil' means ask whether or not to prompt user for breaks.
 If so, call the function specified in the value of the variable
-`type-break-query-function' to do the asking.")
+`type-break-query-function' to do the asking."
+  :type 'boolean
+  :group 'type-break)
 
 (defvar type-break-query-function 'yes-or-no-p
   "Function to use for making query for a typing break.
@@ -137,36 +157,47 @@
 
 To avoid being queried at all, set `type-break-query-mode' to `nil'.")
 
-(defvar type-break-query-interval 60
+(defcustom type-break-query-interval 60
   "*Number of seconds between queries to take a break, if put off.
 The user will continue to be prompted at this interval until he or she
-finally submits to taking a typing break.")
+finally submits to taking a typing break."
+  :type 'integer
+  :group 'type-break)
 
-(defvar type-break-time-warning-intervals '(300 120 60 30)
+(defcustom type-break-time-warning-intervals '(300 120 60 30)
   "*List of time intervals for warnings about upcoming typing break.
 At each of the intervals (specified in seconds) away from a scheduled
-typing break, print a warning in the echo area.")
+typing break, print a warning in the echo area."
+  :type '(repeat integer)
+  :group 'type-break)
 
-(defvar type-break-keystroke-warning-intervals '(300 200 100 50)
+(defcustom type-break-keystroke-warning-intervals '(300 200 100 50)
   "*List of keystroke measurements for warnings about upcoming typing break.
 At each of the intervals (specified in keystrokes) away from the upper
 keystroke threshold, print a warning in the echo area.
 If either this variable or the upper threshold is set, then no warnings
-Will occur.")
+will occur."
+  :type '(repeat integer)
+  :group 'type-break)
 
-(defvar type-break-warning-repeat 40
+
+(defcustom type-break-warning-repeat 40
   "*Number of keystrokes for which warnings should be repeated.
 That is, for each of this many keystrokes the warning is redisplayed
-in the echo area to make sure it's really seen.")
+in the echo area to make sure it's really seen."
+  :type 'integer
+  :group 'type-break)
 
-(defvar type-break-demo-functions
+(defcustom type-break-demo-functions
   '(type-break-demo-boring type-break-demo-life type-break-demo-hanoi)
   "*List of functions to consider running as demos during typing breaks.
 When a typing break begins, one of these functions is selected randomly
 to have emacs do something interesting.
 
 Any function in this list should start a demo which ceases as soon as a
-key is pressed.")
+key is pressed."
+  :type '(repeat function)
+  :group 'type-break)
 
 (defvar type-break-post-command-hook '(type-break-check)
   "Hook run indirectly by post-command-hook for typing break functions.
@@ -180,11 +211,13 @@
 
 ;; Mode line frobs
 
-(defvar type-break-mode-line-message-mode nil
+(defcustom type-break-mode-line-message-mode nil
   "*Non-`nil' means put type-break related messages in the mode line.
 Otherwise, messages typically go in the echo area.
 
-See also `type-break-mode-line-format' and its members.")
+See also `type-break-mode-line-format' and its members."
+  :type 'boolean
+  :group 'type-break)
 
 (defvar type-break-mode-line-format
   '(type-break-mode-line-message-mode
@@ -247,6 +280,7 @@
                  ("\\bLucid\\b"   . lucid)
                  ("^Nemacs\\b"    . nemacs)
                  ("^GNU Emacs 19" . standard19)
+                 ("^GNU Emacs 20" . standard19)
                  ("^GNU Emacs 18" . emacs18)))
         result)
     (while alist
@@ -559,6 +593,8 @@
            (setq type-break-time-last-command (current-time))))
 
     (and type-break-keystroke-threshold
+	 ;; next line is test for 20.2 that can be deleted
+	 ;;(setq type-break-keystroke-count (1+ type-break-keystroke-count))
          (let ((keys (this-command-keys)))
            (cond
             ;; Ignore mouse motion
@@ -1023,4 +1059,6 @@
 
 (provide 'type-break)
 
+(if type-break-mode
+    (type-break-mode 1))
 ;;; type-break.el ends here