Function: type-break-guesstimate-keystroke-threshold
type-break-guesstimate-keystroke-threshold is an autoloaded,
interactive and byte-compiled function defined in type-break.el.gz.
Signature
(type-break-guesstimate-keystroke-threshold WPM &optional WORDLEN FRAC)
Documentation
Guess values for the minimum/maximum keystroke threshold for typing breaks.
If called interactively, the user is prompted for their guess as to how many words per minute they usually type. This value should not be your maximum WPM, but your average. Of course, this is harder to gauge since it can vary considerably depending on what you are doing. For example, one tends to type less when debugging a program as opposed to writing documentation. (Perhaps a separate program should be written to estimate average typing speed.)
From that, this command sets the values in type-break-keystroke-threshold
based on a fairly simple algorithm involving assumptions about the average
length of words (5). For the minimum threshold, it uses about a fifth of
the computed maximum threshold.
When called from Lisp programs, the optional args WORDLEN and FRAC can be
used to override the default assumption about average word length and the
fraction of the maximum threshold to which to set the minimum threshold.
FRAC should be the inverse of the fractional value; for example, a value of
2 would mean to use one half, a value of 4 would mean to use one quarter, etc.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/type-break.el.gz
;;;###autoload
(defun type-break-guesstimate-keystroke-threshold (wpm &optional wordlen frac)
"Guess values for the minimum/maximum keystroke threshold for typing breaks.
If called interactively, the user is prompted for their guess as to how
many words per minute they usually type. This value should not be your
maximum WPM, but your average. Of course, this is harder to gauge since it
can vary considerably depending on what you are doing. For example, one
tends to type less when debugging a program as opposed to writing
documentation. (Perhaps a separate program should be written to estimate
average typing speed.)
From that, this command sets the values in `type-break-keystroke-threshold'
based on a fairly simple algorithm involving assumptions about the average
length of words (5). For the minimum threshold, it uses about a fifth of
the computed maximum threshold.
When called from Lisp programs, the optional args WORDLEN and FRAC can be
used to override the default assumption about average word length and the
fraction of the maximum threshold to which to set the minimum threshold.
FRAC should be the inverse of the fractional value; for example, a value of
2 would mean to use one half, a value of 4 would mean to use one quarter, etc."
(interactive "NOn average, how many words per minute do you type? ")
(let* ((upper (* wpm (or wordlen 5) (/ type-break-interval 60)))
(lower (/ upper (or frac 5))))
(or type-break-keystroke-threshold
(setq type-break-keystroke-threshold (cons nil nil)))
(setcar type-break-keystroke-threshold lower)
(setcdr type-break-keystroke-threshold upper)
(if (called-interactively-p 'interactive)
(message "min threshold: %d\tmax threshold: %d" lower upper))
type-break-keystroke-threshold))