]> code.delx.au - gnu-emacs/blobdiff - lisp/type-break.el
Update copyright year to 2015
[gnu-emacs] / lisp / type-break.el
index 949b3b720a0e0963e364eb70486a3c4bc79355db..a5a31c9ffd1dd3e920e0089e8fd1774513c28de5 100644 (file)
@@ -1,6 +1,7 @@
 ;;; type-break.el --- encourage rests from typing at appropriate intervals  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1995, 1997, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 1997, 2000-2015 Free Software Foundation,
+;; Inc.
 
 ;; Author: Noah Friedman
 ;; Maintainer: Noah Friedman <friedman@splode.com>
@@ -94,7 +95,7 @@ When this variable is non-nil, its value is considered to be a \"good\"
 length (in seconds) for a break initiated by the command `type-break',
 overriding `type-break-good-rest-interval'.  This provides querying of
 break interruptions when `type-break-good-rest-interval' is nil."
-  :type 'integer
+  :type '(choice (const nil) integer)
   :group 'type-break)
 
 (defcustom type-break-keystroke-threshold
@@ -203,11 +204,12 @@ key is pressed."
   :type 'boolean
   :group 'type-break)
 
-(defcustom type-break-file-name (convert-standard-filename "~/.type-break")
+(defcustom type-break-file-name
+  (locate-user-emacs-file "type-break" ".type-break")
   "Name of file used to save state across sessions.
 If this is nil, no data will be saved across sessions."
-  :type 'file
-  :group 'type-break)
+  :version "24.4"                       ; added locate-user
+  :type 'file)
 
 (defvar type-break-post-command-hook '(type-break-check)
   "Hook run indirectly by `post-command-hook' for typing break functions.
@@ -417,7 +419,7 @@ Variables controlling the display of messages in the mode line include:
         `global-mode-string'
         `type-break-mode-line-break-message'
         `type-break-mode-line-warning'"
-  :global t)
+  :global t :group 'type-break)
 
 (define-minor-mode type-break-query-mode
   "Toggle typing break queries.
@@ -427,7 +429,7 @@ enable them if ARG is omitted or nil.
 
 The user may also enable or disable this mode simply by setting
 the variable of the same name."
-  :global t)
+  :global t :group 'type-break)
 
 \f
 ;;; session file functions
@@ -603,8 +605,7 @@ INTERVAL is the full length of an interval (defaults to TIME)."
   (type-break-time-warning-schedule time 'reset)
   (type-break-run-at-time (max 1 time) nil 'type-break-alarm)
   (setq type-break-time-next-break
-        (type-break-time-sum (or start (current-time))
-                             (or interval time))))
+        (type-break-time-sum start (or interval time))))
 
 (defun type-break-cancel-schedule ()
   (type-break-cancel-time-warning-schedule)
@@ -960,19 +961,11 @@ FRAC should be the inverse of the fractional value; for example, a value of
 (defun type-break-time-difference (a b)
   (round (float-time (time-subtract b a))))
 
-;; Return (in a new list the same in structure to that returned by
-;; `current-time') the sum of the arguments.  Each argument may be a time
-;; list or a single integer, a number of seconds.
-;; This function keeps the high and low 16 bits of the seconds properly
-;; balanced so that the lower value never exceeds 16 bits.  Otherwise, when
-;; the result is passed to `current-time-string' it will toss some of the
-;; "low" bits and format the time incorrectly.
+;; Return a time value that is the sum of the time-value arguments.
 (defun type-break-time-sum (&rest tmlist)
-  (let ((sum '(0 0 0)))
+  (let ((sum '(0 0)))
     (dolist (tem tmlist)
-      (setq sum (time-add sum (if (integerp tem)
-                                 (list (floor tem 65536) (mod tem 65536))
-                               tem))))
+      (setq sum (time-add sum tem)))
     sum))
 
 (defun type-break-time-stamp (&optional when)