Function: type-break
type-break is an autoloaded, interactive and byte-compiled function
defined in type-break.el.gz.
Signature
(type-break)
Documentation
Take a typing break.
During the break, a demo selected from the functions listed in
type-break-demo-functions is run.
After the typing break is finished, the next break is scheduled
as per the function type-break-schedule.
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/type-break.el.gz
;;;###autoload
(defun type-break ()
"Take a typing break.
During the break, a demo selected from the functions listed in
`type-break-demo-functions' is run.
After the typing break is finished, the next break is scheduled
as per the function `type-break-schedule'."
(interactive)
(do-auto-save)
(type-break-cancel-schedule)
;; 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)))
(setq type-break-time-last-break start-time)
(while continue
(save-window-excursion
;; Eat the screen.
(and (eq (selected-window) (minibuffer-window))
(other-window 1))
(delete-other-windows)
(scroll-right (window-width))
(unless type-break-terse-messages
(message "Press any key to resume from typing break."))
(let* ((len (length type-break-demo-functions))
(idx (random len))
(fn (nth idx type-break-demo-functions)))
(condition-case ()
(funcall fn)
(error nil))))
(let ((good-interval (or type-break-good-rest-interval
type-break-good-break-interval)))
(cond
(good-interval
(let ((break-secs (type-break-time-difference
start-time nil)))
(cond
((>= break-secs good-interval)
(setq continue nil))
;; 60 seconds may be too much leeway if the break is only 3
;; minutes to begin with. You can just say "no" to the query
;; below if you're in that much of a hurry.
;;((> 60 (abs (- break-secs good-interval)))
;; (setq continue nil))
((funcall
type-break-query-function
(format
(if type-break-terse-messages
"%s%s remaining. Continue break? "
"%sYou really ought to rest %s more. Continue break? ")
(type-break-time-stamp)
(type-break-format-time (- good-interval
break-secs)))))
(t
(setq continue nil)))))
(t (setq continue nil))))))
(type-break-keystroke-reset)
(type-break-file-time)
(type-break-mode-line-countdown-or-break nil)
(type-break-schedule))