;; in the mode line instead, do M-x type-break-mode-line-message-mode
;; or set the variable of the same name to t.
-;; This program can truly cons up a storm because of all the calls to
-;; `current-time' (which always returns fresh conses). I'm dismayed by
-;; this, but I think the health of my hands is far more important than a
-;; few pages of virtual memory.
-
;; This package was inspired by Roland McGrath's hanoi-break.el.
;; Several people contributed feedback and ideas, including
;; Roland McGrath <roland@gnu.org>
(defvar type-break-keystroke-count 0)
(defvar type-break-time-last-break nil)
(defvar type-break-time-next-break nil)
-(defvar type-break-time-last-command (current-time))
+(defvar type-break-time-last-command (time-convert nil 'integer))
(defvar type-break-current-time-warning-interval nil)
(defvar type-break-current-keystroke-warning-interval nil)
(defvar type-break-time-warning-count 0)
(setq type-break-time-last-break
(or (type-break-get-previous-time)
- (current-time)))
+ (time-convert nil 'integer)))
;; Schedule according to break time from session file.
(type-break-schedule
(setq type-break-interval-start type-break-time-last-break)
(- type-break-interval diff))
;; Schedule from now.
- (setq type-break-interval-start (current-time))
+ (setq type-break-interval-start (time-convert nil 'integer))
(type-break-file-time type-break-interval-start)
type-break-interval))
type-break-interval-start
;; remove any query scheduled during interactive invocation
(remove-hook 'type-break-post-command-hook 'type-break-do-query)
(let ((continue t)
- (start-time (current-time)))
+ (start-time (time-convert nil 'integer)))
(setq type-break-time-last-break start-time)
(while continue
(save-window-excursion
(progn
(type-break-keystroke-reset)
(type-break-mode-line-countdown-or-break nil)
- (setq type-break-time-last-break (current-time))
+ (setq type-break-time-last-break (time-convert nil 'integer))
(type-break-schedule)))
- (setq type-break-time-last-command (current-time))))
+ (setq type-break-time-last-command (time-convert nil 'integer))))
(and type-break-keystroke-threshold
(let ((keys (this-command-keys)))
\f
;;; misc functions
-;; Compute the difference, in seconds, between a and b, two structures
-;; similar to those returned by `current-time'.
+;; Compute the difference, in seconds, between a and b, two time values.
(defun type-break-time-difference (a b)
(round (float-time (time-subtract b a))))
;; Return a time value that is the sum of the time-value arguments.
(defun type-break-time-sum (&rest tmlist)
- (let ((sum '(0 0)))
+ (let ((sum 0))
(dolist (tem tmlist)
(setq sum (time-add sum tem)))
sum))
(t (format "%d seconds" secs)))))
(defun type-break-keystroke-reset ()
- (setq type-break-interval-start (current-time)) ; not a keystroke
+ (setq type-break-interval-start (time-convert nil 'integer))
(setq type-break-keystroke-count 0)
(setq type-break-keystroke-warning-count 0)
(setq type-break-current-keystroke-warning-interval