emacs/lisp/type-break.el

1144 lines
46 KiB
EmacsLisp
Raw Normal View History

;;; type-break.el --- encourage rests from typing at appropriate intervals -*- lexical-binding: t -*-
2024-01-02 01:47:10 +00:00
;; Copyright (C) 1994-1995, 1997, 2000-2024 Free Software Foundation,
;; Inc.
;; Author: Noah Friedman <friedman@splode.com>
;; Keywords: extensions, timers
;; Created: 1994-07-13
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; The docstring for the function `type-break-mode' summarizes most of the
;; details of the interface.
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;; This package relies on the assumption that you live entirely in Emacs,
;; as the author does. If that's not the case for you (e.g. you often
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;; suspend Emacs or work in other windows) then this won't help very much;
;; it will depend on just how often you switch back to Emacs. At the very
;; least, you will want to turn off the keystroke thresholds and rest
;; interval tracking.
;; If you prefer not to be queried about taking breaks, but instead just
;; want to be reminded, do the following:
;;
;; (setq type-break-query-mode nil)
;;
;; Or call the command `type-break-query-mode' with a negative prefix
;; argument.
;; If you find echo area messages annoying and would prefer to see messages
;; 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 package was inspired by Roland McGrath's hanoi-break.el.
;; Several people contributed feedback and ideas, including
1999-08-16 04:04:27 +00:00
;; Roland McGrath <roland@gnu.org>
;; Kleanthes Koniaris <kgk@koniaris.com>
1999-08-16 04:04:27 +00:00
;; Mark Ashton <mpashton@gnu.org>
;; Matt Wilding <wilding@cli.com>
;; Robert S. Boyer <boyer@cs.utexas.edu>
;;; Code:
(defgroup type-break nil
"Encourage the user to take a rest from typing at suitable intervals."
:prefix "type-break"
:group 'keyboard)
(defcustom type-break-interval (* 60 60)
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Number of seconds between scheduled typing breaks."
Make some additional defcustom types more restrictive * lisp/desktop.el (desktop-lazy-idle-delay): * lisp/files.el (dired-kept-versions) (kept-old-versions, kept-new-versions): * lisp/filesets.el (filesets-max-submenu-length) (filesets-max-entry-length, filesets-tree-max-level) (filesets-query-user-limit): * lisp/hi-lock.el (hi-lock-file-patterns-range) (hi-lock-highlight-range): * lisp/ido.el (ido-max-work-directory-list): * lisp/image/gravatar.el (gravatar-cache-ttl): * lisp/imenu.el (imenu-auto-rescan-maxout, imenu-max-items): * lisp/informat.el (Info-split-threshold): * lisp/mail/hashcash.el (hashcash-default-payment) (hashcash-default-accept-payment): * lisp/mail/mail-hist.el (mail-hist-history-size): * lisp/mail/smtpmail.el (smtpmail-retries): * lisp/msb.el (msb-display-most-recently-used): * lisp/nxml/rng-valid.el (rng-state-cache-distance) (rng-validate-chunk-size): * lisp/progmodes/gdb-mi.el (gdb-max-source-window-count): * lisp/recentf.el (recentf-arrange-by-rules-min-items): * lisp/simple.el (kill-ring-max, mark-ring-max) (global-mark-ring-max): * lisp/tab-line.el (tab-line-tab-name-truncated-max): * lisp/term.el (term-buffer-maximum-size, term-input-chunk-size): * lisp/thumbs.el (thumbs-max-image-number) (thumbs-thumbsdir-max-size, thumbs-relief, thumbs-margin) (thumbs-image-resizing-step): * lisp/type-break.el (type-break-interval) (type-break-good-rest-interval, type-break-query-interval) (type-break-warning-repeat): * lisp/vc/compare-w.el (compare-windows-sync-string-size): * lisp/woman.el (woman-fill-column): Use defcustom :type natnum. * lisp/emacs-lisp/backtrace.el (backtrace-line-length): * lisp/doc-view.el (doc-view-conversion-refresh-interval): Use defcustom :type natnum and allow the nil value. * lisp/gnus/spam-stat.el (spam-stat-process-directory-age): Use defcustom :type integer.
2022-07-06 17:29:51 +00:00
:type 'natnum
:group 'type-break)
(defcustom type-break-good-rest-interval (/ type-break-interval 6)
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Number of seconds of idle time considered to be an adequate typing rest.
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
When this variable is non-nil, Emacs checks the idle time between
keystrokes. If this idle time is long enough to be considered a \"good\"
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."
:set-after '(type-break-interval)
:type '(choice (const :tag "Don't check idle time" nil)
natnum)
:group 'type-break)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defcustom type-break-good-break-interval nil
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Number of seconds considered to be an adequate explicit typing rest.
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
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."
Fix a bunch of custom types (thank you cus-test.el) * lisp/bookmark.el (bookmark-search-delay): * lisp/cus-start.el (vertical-centering-font-regexp): * lisp/ps-mule.el (ps-mule-font-info-database-default): * lisp/ps-print.el (ps-default-fg, ps-default-bg): * lisp/type-break.el (type-break-good-break-interval): * lisp/whitespace.el (whitespace-indentation-regexp) (whitespace-space-after-tab-regexp): * lisp/emacs-lisp/testcover.el (testcover-1value-functions) (testcover-noreturn-functions, testcover-progn-functions) (testcover-prog1-functions): * lisp/emulation/viper-init.el (viper-emacs-state-cursor-color): * lisp/erc/erc-desktop-notifications.el (erc-notifications-icon): * lisp/eshell/em-glob.el (eshell-glob-translate-alist): * lisp/gnus/gnus-art.el (gnus-article-date-headers, gnus-blocked-images): * lisp/gnus/gnus-async.el (gnus-async-post-fetch-function): * lisp/gnus/gnus-gravatar.el (gnus-gravatar-size, gnus-gravatar-properties): * lisp/gnus/gnus-html.el (gnus-html-image-cache-ttl): * lisp/gnus/gnus-notifications.el (gnus-notifications-timeout): * lisp/gnus/gnus-picon.el (gnus-picon-properties): * lisp/gnus/gnus-util.el (gnus-completion-styles): * lisp/gnus/gnus.el (gnus-other-frame-resume-function): * lisp/gnus/message.el (message-user-organization-file) (message-cite-reply-position): * lisp/gnus/nnir.el (nnir-summary-line-format) (nnir-retrieve-headers-override-function): * lisp/gnus/shr-color.el (shr-color-visible-luminance-min): * lisp/gnus/shr.el (shr-blocked-images): * lisp/gnus/spam-report.el (spam-report-resend-to): * lisp/gnus/spam.el (spam-summary-exit-behavior): * lisp/mh-e/mh-e.el (mh-sortm-args, mh-default-folder-for-message-function): * lisp/play/tetris.el (tetris-tty-colors): * lisp/progmodes/cpp.el (cpp-face-default-list): * lisp/progmodes/flymake.el (flymake-allowed-file-name-masks): * lisp/progmodes/idlw-help.el (idlwave-help-browser-generic-program) (idlwave-help-browser-generic-args): * lisp/progmodes/make-mode.el (makefile-special-targets-list): * lisp/progmodes/python.el (python-shell-virtualenv-path): * lisp/progmodes/verilog-mode.el (verilog-active-low-regexp) (verilog-auto-input-ignore-regexp, verilog-auto-inout-ignore-regexp) (verilog-auto-output-ignore-regexp, verilog-auto-tieoff-ignore-regexp) (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp): * lisp/textmodes/reftex-vars.el (reftex-format-label-function): * lisp/textmodes/remember.el (remember-diary-file): Fix custom types. * lisp/cedet/semantic/db-find.el (semanticdb-find-throttle-custom-list): Fix value. * lisp/gnus/gnus-salt.el (gnus-selected-tree-face): Fix default.
2013-05-09 01:40:20 +00:00
:type '(choice (const nil) integer)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
:group 'type-break)
(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
;; about 5 letters, default upper threshold to the average number of
;; keystrokes one is likely to type in a break interval. That way if the
;; user goes through a furious burst of typing activity, cause a typing
;; break to be required sooner than originally scheduled.
;; Conversely, the minimum threshold should be about a fifth of this.
(let* ((wpm 35)
(avg-word-length 5)
(upper (* wpm avg-word-length (/ type-break-interval 60)))
(lower (/ upper 5)))
(cons lower upper))
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Upper and lower bound on number of keystrokes for considering typing break.
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
the scheduled time has elapsed; the break is simply rescheduled until later
if the minimum threshold hasn't been reached. If this first value is nil,
then there is no minimum threshold; as soon as the scheduled time has
elapsed, the user will always be queried.
The second number is the maximum number of keystrokes that can be entered
before a typing break is requested immediately, pre-empting the originally
scheduled break. If this second value is nil, then no pre-emptive breaks
will occur; only scheduled ones will.
Keys with bucky bits (shift, control, meta, etc) are counted as only one
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."
:set-after '(type-break-interval)
:type '(cons (choice integer (const nil)) (choice integer (const nil)))
:group 'type-break)
(defcustom type-break-query-function 'yes-or-no-p
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Function to use for making query for a typing break.
It should take a string as an argument, the prompt.
Usually this should be set to `yes-or-no-p' or `y-or-n-p'.
To avoid being queried at all, set `type-break-query-mode' to nil."
:type '(radio function
(function-item yes-or-no-p)
(function-item y-or-n-p))
:group 'type-break)
(defcustom type-break-query-interval 60
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"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."
Make some additional defcustom types more restrictive * lisp/desktop.el (desktop-lazy-idle-delay): * lisp/files.el (dired-kept-versions) (kept-old-versions, kept-new-versions): * lisp/filesets.el (filesets-max-submenu-length) (filesets-max-entry-length, filesets-tree-max-level) (filesets-query-user-limit): * lisp/hi-lock.el (hi-lock-file-patterns-range) (hi-lock-highlight-range): * lisp/ido.el (ido-max-work-directory-list): * lisp/image/gravatar.el (gravatar-cache-ttl): * lisp/imenu.el (imenu-auto-rescan-maxout, imenu-max-items): * lisp/informat.el (Info-split-threshold): * lisp/mail/hashcash.el (hashcash-default-payment) (hashcash-default-accept-payment): * lisp/mail/mail-hist.el (mail-hist-history-size): * lisp/mail/smtpmail.el (smtpmail-retries): * lisp/msb.el (msb-display-most-recently-used): * lisp/nxml/rng-valid.el (rng-state-cache-distance) (rng-validate-chunk-size): * lisp/progmodes/gdb-mi.el (gdb-max-source-window-count): * lisp/recentf.el (recentf-arrange-by-rules-min-items): * lisp/simple.el (kill-ring-max, mark-ring-max) (global-mark-ring-max): * lisp/tab-line.el (tab-line-tab-name-truncated-max): * lisp/term.el (term-buffer-maximum-size, term-input-chunk-size): * lisp/thumbs.el (thumbs-max-image-number) (thumbs-thumbsdir-max-size, thumbs-relief, thumbs-margin) (thumbs-image-resizing-step): * lisp/type-break.el (type-break-interval) (type-break-good-rest-interval, type-break-query-interval) (type-break-warning-repeat): * lisp/vc/compare-w.el (compare-windows-sync-string-size): * lisp/woman.el (woman-fill-column): Use defcustom :type natnum. * lisp/emacs-lisp/backtrace.el (backtrace-line-length): * lisp/doc-view.el (doc-view-conversion-refresh-interval): Use defcustom :type natnum and allow the nil value. * lisp/gnus/spam-stat.el (spam-stat-process-directory-age): Use defcustom :type integer.
2022-07-06 17:29:51 +00:00
:type 'natnum
:group 'type-break)
(defcustom type-break-time-warning-intervals '(300 120 60 30)
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"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."
:type '(repeat integer)
:group 'type-break)
(defcustom type-break-keystroke-warning-intervals '(300 200 100 50)
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"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."
:type '(repeat integer)
:group 'type-break)
(defcustom type-break-warning-repeat 40
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"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."
Make some additional defcustom types more restrictive * lisp/desktop.el (desktop-lazy-idle-delay): * lisp/files.el (dired-kept-versions) (kept-old-versions, kept-new-versions): * lisp/filesets.el (filesets-max-submenu-length) (filesets-max-entry-length, filesets-tree-max-level) (filesets-query-user-limit): * lisp/hi-lock.el (hi-lock-file-patterns-range) (hi-lock-highlight-range): * lisp/ido.el (ido-max-work-directory-list): * lisp/image/gravatar.el (gravatar-cache-ttl): * lisp/imenu.el (imenu-auto-rescan-maxout, imenu-max-items): * lisp/informat.el (Info-split-threshold): * lisp/mail/hashcash.el (hashcash-default-payment) (hashcash-default-accept-payment): * lisp/mail/mail-hist.el (mail-hist-history-size): * lisp/mail/smtpmail.el (smtpmail-retries): * lisp/msb.el (msb-display-most-recently-used): * lisp/nxml/rng-valid.el (rng-state-cache-distance) (rng-validate-chunk-size): * lisp/progmodes/gdb-mi.el (gdb-max-source-window-count): * lisp/recentf.el (recentf-arrange-by-rules-min-items): * lisp/simple.el (kill-ring-max, mark-ring-max) (global-mark-ring-max): * lisp/tab-line.el (tab-line-tab-name-truncated-max): * lisp/term.el (term-buffer-maximum-size, term-input-chunk-size): * lisp/thumbs.el (thumbs-max-image-number) (thumbs-thumbsdir-max-size, thumbs-relief, thumbs-margin) (thumbs-image-resizing-step): * lisp/type-break.el (type-break-interval) (type-break-good-rest-interval, type-break-query-interval) (type-break-warning-repeat): * lisp/vc/compare-w.el (compare-windows-sync-string-size): * lisp/woman.el (woman-fill-column): Use defcustom :type natnum. * lisp/emacs-lisp/backtrace.el (backtrace-line-length): * lisp/doc-view.el (doc-view-conversion-refresh-interval): Use defcustom :type natnum and allow the nil value. * lisp/gnus/spam-stat.el (spam-stat-process-directory-age): Use defcustom :type integer.
2022-07-06 17:29:51 +00:00
:type 'natnum
:group 'type-break)
(defcustom type-break-time-stamp-format "[%H:%M] "
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Timestamp format used to prefix messages.
Format specifiers are as used by `format-time-string'."
:type 'string
:group 'type-break)
(defcustom type-break-demo-functions
'(type-break-demo-boring type-break-demo-life type-break-demo-hanoi)
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"List of functions to consider running as demos during typing breaks.
When a typing break begins, one of these functions is selected randomly
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
to have Emacs do something interesting.
1994-02-14 00:41:56 +00:00
Any function in this list should start a demo which ceases as soon as a
key is pressed."
:type '(repeat function)
:group 'type-break)
1994-02-14 00:41:56 +00:00
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defcustom type-break-demo-boring-stats nil
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Show word per minute and keystroke figures in the Boring demo."
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
:type 'boolean
:group 'type-break)
(defcustom type-break-terse-messages nil
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Use slightly terser messages."
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
:type 'boolean
:group 'type-break)
(defcustom type-break-file-name
(locate-user-emacs-file "type-break" ".type-break")
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"Name of file used to save state across sessions.
If this is nil, no data will be saved across sessions."
:version "24.4" ; added locate-user
:type '(choice (const :tag "Don't save data" nil)
file))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defvar type-break-post-command-hook '(type-break-check)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
"Hook run indirectly by `post-command-hook' for typing break functions.
This is not really intended to be set by the user, but it's probably
harmless to do so. Mainly it is used by various parts of the typing break
program to delay actions until after the user has completed some command.
It exists because `post-command-hook' itself is inaccessible while its
functions are being run, and some type-break--related functions want to
remove themselves after running.")
;; Mode line frobs
(defvar type-break-mode-line-format
'(type-break-mode-line-message-mode
(""
type-break-mode-line-break-message
type-break-mode-line-warning))
"Format of messages in the mode line concerning typing breaks.")
(defvar type-break-mode-line-break-message
'(type-break-mode-line-break-message-p
type-break-mode-line-break-string))
(defvar type-break-mode-line-break-message-p nil)
(defvar type-break-mode-line-break-string " *** TAKE A TYPING BREAK NOW ***")
(defvar type-break-mode-line-warning
'(type-break-mode-line-break-message-p
("")
(type-break-warning-countdown-string
(" *** "
"Break in "
type-break-warning-countdown-string
" "
type-break-warning-countdown-string-type
"***"))))
(defvar type-break-warning-countdown-string nil
"If non-nil, this is a countdown for the next typing break.
This variable, in conjunction with `type-break-warning-countdown-string-type'
\(which indicates whether this value is a number of keystrokes or seconds)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
is installed in `mode-line-format' to notify of imminent typing breaks.")
(defvar type-break-warning-countdown-string-type nil
"Indicates the unit type of `type-break-warning-countdown-string'.
It will be either \"seconds\" or \"keystrokes\".")
;; These are internal variables. Do not set them yourself.
1994-02-14 00:41:56 +00:00
(defvar type-break-alarm-p nil)
(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 (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)
(defvar type-break-keystroke-warning-count 0)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defvar type-break-interval-start nil)
;;;###autoload
(define-minor-mode type-break-mode
"Enable or disable typing-break mode.
This is a minor mode, but it is global to all buffers by default.
When this mode is enabled, the user is encouraged to take typing breaks at
appropriate intervals; either after a specified amount of time or when the
user has exceeded a keystroke threshold. When the time arrives, the user
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
is asked to take a break. If the user refuses at that time, Emacs will ask
again in a short period of time. The idea is to give the user enough time
to find a good breaking point in his or her work, but be sufficiently
annoying to discourage putting typing breaks off indefinitely.
The user may enable or disable this mode by setting the variable of the
same name, though setting it in that way doesn't reschedule a break or
reset the keystroke counter.
If the mode was previously disabled and is enabled as a consequence of
calling this function, it schedules a break with `type-break-schedule' to
make sure one occurs (the user can call that command to reschedule the
break at any time). It also initializes the keystroke counter.
The variable `type-break-interval' specifies the number of seconds to
schedule between regular typing breaks. This variable doesn't directly
affect the time schedule; it simply provides a default for the
`type-break-schedule' command.
If set, the variable `type-break-good-rest-interval' specifies the minimum
amount of time which is considered a reasonable typing break. Whenever
that time has elapsed, typing breaks are automatically rescheduled for
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
later even if Emacs didn't prompt you to take one first. Also, if a break
is ended before this much time has elapsed, the user will be asked whether
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
or not to continue. A nil value for this variable prevents automatic
break rescheduling, making `type-break-interval' an upper bound on the time
between breaks. In this case breaks will be prompted for as usual before
the upper bound if the keystroke threshold is reached.
If `type-break-good-rest-interval' is nil and
`type-break-good-break-interval' is set, then confirmation is required to
interrupt a break before `type-break-good-break-interval' seconds
have passed. This provides for an upper bound on the time between breaks
together with confirmation of interruptions to these breaks.
The variable `type-break-keystroke-threshold' is used to determine the
thresholds at which typing breaks should be considered. You can use
the command `type-break-guesstimate-keystroke-threshold' to try to
approximate good values for this.
There are several variables that affect how or when warning messages about
imminent typing breaks are displayed. They include:
`type-break-mode-line-message-mode'
`type-break-time-warning-intervals'
`type-break-keystroke-warning-intervals'
`type-break-warning-repeat'
`type-break-warning-countdown-string'
`type-break-warning-countdown-string-type'
There are several variables that affect if, how, and when queries to begin
a typing break occur. They include:
`type-break-query-mode'
`type-break-query-function'
`type-break-query-interval'
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
The command `type-break-statistics' prints interesting things.
Finally, a file (named `type-break-file-name') is used to store information
across Emacs sessions. This provides recovery of the break status between
sessions and after a crash. Manual changes to the file may result in
problems."
:lighter type-break-mode-line-format
:global t
(type-break-check-post-command-hook)
(cond
;; ((and already-enabled type-break-mode)
;; (and (called-interactively-p 'interactive)
;; (message "Type Break mode is already enabled")))
(type-break-mode
(when type-break-file-name
(with-current-buffer (find-file-noselect type-break-file-name 'nowarn)
(setq buffer-save-without-query t)))
(or global-mode-string (setq global-mode-string '(""))) ;FIXME: Why?
(type-break-keystroke-reset)
(type-break-mode-line-countdown-or-break nil)
(setq type-break-time-last-break
(or (type-break-get-previous-time)
(time-convert nil 'integer)))
;; Schedule according to break time from session file.
(type-break-schedule
(let (diff)
(if (and type-break-time-last-break
(< (setq diff (type-break-time-difference
type-break-time-last-break
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
nil))
type-break-interval))
;; Use the file's value.
(progn
(setq type-break-keystroke-count
(type-break-get-previous-count))
;; File the time, in case it was read from the auto-save file.
(type-break-file-time type-break-interval-start)
(setq type-break-interval-start type-break-time-last-break)
(- type-break-interval diff))
;; Schedule from now.
(setq type-break-interval-start (time-convert nil 'integer))
(type-break-file-time type-break-interval-start)
type-break-interval))
type-break-interval-start
type-break-interval))
(t
(type-break-keystroke-reset)
(type-break-mode-line-countdown-or-break nil)
(type-break-cancel-schedule)
(do-auto-save)
(when type-break-file-name
(with-current-buffer (find-file-noselect type-break-file-name
'nowarn)
(set-buffer-modified-p nil)
(unlock-buffer)
(kill-current-buffer))))))
(define-minor-mode type-break-mode-line-message-mode
Fix minor mode docstrings for the new meaning of a nil ARG. * abbrev.el (abbrev-mode): * allout.el (allout-mode): * autoinsert.el (auto-insert-mode): * autoarg.el (autoarg-mode, autoarg-kp-mode): * autorevert.el (auto-revert-mode, auto-revert-tail-mode) (global-auto-revert-mode): * battery.el (display-battery-mode): * composite.el (global-auto-composition-mode) (auto-composition-mode): * delsel.el (delete-selection-mode): * desktop.el (desktop-save-mode): * dired-x.el (dired-omit-mode): * dirtrack.el (dirtrack-mode): * doc-view.el (doc-view-minor-mode): * double.el (double-mode): * electric.el (electric-indent-mode, electric-pair-mode): * emacs-lock.el (emacs-lock-mode): * epa-hook.el (auto-encryption-mode): * follow.el (follow-mode): * font-core.el (font-lock-mode): * frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode): * help.el (temp-buffer-resize-mode): * hilit-chg.el (highlight-changes-mode) (highlight-changes-visible-mode): * hi-lock.el (hi-lock-mode): * hl-line.el (hl-line-mode, global-hl-line-mode): * icomplete.el (icomplete-mode): * ido.el (ido-everywhere): * image-file.el (auto-image-file-mode): * image-mode.el (image-minor-mode): * iswitchb.el (iswitchb-mode): * jka-cmpr-hook.el (auto-compression-mode): * linum.el (linum-mode): * longlines.el (longlines-mode): * master.el (master-mode): * mb-depth.el (minibuffer-depth-indicate-mode): * menu-bar.el (menu-bar-mode): * minibuf-eldef.el (minibuffer-electric-default-mode): * mouse-sel.el (mouse-sel-mode): * msb.el (msb-mode): * mwheel.el (mouse-wheel-mode): * outline.el (outline-minor-mode): * paren.el (show-paren-mode): * recentf.el (recentf-mode): * reveal.el (reveal-mode, global-reveal-mode): * rfn-eshadow.el (file-name-shadow-mode): * ruler-mode.el (ruler-mode): * savehist.el (savehist-mode): * scroll-all.el (scroll-all-mode): * scroll-bar.el (scroll-bar-mode): * server.el (server-mode): * shell.el (shell-dirtrack-mode): * simple.el (auto-fill-mode, transient-mark-mode) (visual-line-mode, overwrite-mode, binary-overwrite-mode) (line-number-mode, column-number-mode, size-indication-mode) (auto-save-mode, normal-erase-is-backspace-mode, visible-mode): * strokes.el (strokes-mode): * time.el (display-time-mode): * t-mouse.el (gpm-mouse-mode): * tool-bar.el (tool-bar-mode): * tooltip.el (tooltip-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * view.el (view-mode): * whitespace.el (whitespace-mode, whitespace-newline-mode) (global-whitespace-mode, global-whitespace-newline-mode): * xt-mouse.el (xterm-mouse-mode): Doc fix. * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix autogenerated docstring.
2011-10-19 12:54:24 +00:00
"Toggle warnings about typing breaks in the mode line.
Fix minor mode docstrings for the new meaning of a nil ARG. * abbrev.el (abbrev-mode): * allout.el (allout-mode): * autoinsert.el (auto-insert-mode): * autoarg.el (autoarg-mode, autoarg-kp-mode): * autorevert.el (auto-revert-mode, auto-revert-tail-mode) (global-auto-revert-mode): * battery.el (display-battery-mode): * composite.el (global-auto-composition-mode) (auto-composition-mode): * delsel.el (delete-selection-mode): * desktop.el (desktop-save-mode): * dired-x.el (dired-omit-mode): * dirtrack.el (dirtrack-mode): * doc-view.el (doc-view-minor-mode): * double.el (double-mode): * electric.el (electric-indent-mode, electric-pair-mode): * emacs-lock.el (emacs-lock-mode): * epa-hook.el (auto-encryption-mode): * follow.el (follow-mode): * font-core.el (font-lock-mode): * frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode): * help.el (temp-buffer-resize-mode): * hilit-chg.el (highlight-changes-mode) (highlight-changes-visible-mode): * hi-lock.el (hi-lock-mode): * hl-line.el (hl-line-mode, global-hl-line-mode): * icomplete.el (icomplete-mode): * ido.el (ido-everywhere): * image-file.el (auto-image-file-mode): * image-mode.el (image-minor-mode): * iswitchb.el (iswitchb-mode): * jka-cmpr-hook.el (auto-compression-mode): * linum.el (linum-mode): * longlines.el (longlines-mode): * master.el (master-mode): * mb-depth.el (minibuffer-depth-indicate-mode): * menu-bar.el (menu-bar-mode): * minibuf-eldef.el (minibuffer-electric-default-mode): * mouse-sel.el (mouse-sel-mode): * msb.el (msb-mode): * mwheel.el (mouse-wheel-mode): * outline.el (outline-minor-mode): * paren.el (show-paren-mode): * recentf.el (recentf-mode): * reveal.el (reveal-mode, global-reveal-mode): * rfn-eshadow.el (file-name-shadow-mode): * ruler-mode.el (ruler-mode): * savehist.el (savehist-mode): * scroll-all.el (scroll-all-mode): * scroll-bar.el (scroll-bar-mode): * server.el (server-mode): * shell.el (shell-dirtrack-mode): * simple.el (auto-fill-mode, transient-mark-mode) (visual-line-mode, overwrite-mode, binary-overwrite-mode) (line-number-mode, column-number-mode, size-indication-mode) (auto-save-mode, normal-erase-is-backspace-mode, visible-mode): * strokes.el (strokes-mode): * time.el (display-time-mode): * t-mouse.el (gpm-mouse-mode): * tool-bar.el (tool-bar-mode): * tooltip.el (tooltip-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * view.el (view-mode): * whitespace.el (whitespace-mode, whitespace-newline-mode) (global-whitespace-mode, global-whitespace-newline-mode): * xt-mouse.el (xterm-mouse-mode): Doc fix. * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix autogenerated docstring.
2011-10-19 12:54:24 +00:00
The user may also enable or disable this mode simply by setting
the variable of the same name.
Variables controlling the display of messages in the mode line include:
`mode-line-format'
`global-mode-string'
`type-break-mode-line-break-message'
`type-break-mode-line-warning'"
Misc custom group fixes * cus-start.el (show-trailing-whitespace): Move to editing basics. * faces.el (trailing-whitespace): Don't use whitespace-faces group. * obsolete/old-whitespace.el (whitespace-faces): Remove group. (whitespace-highlight): Move to whitespace group. * comint.el (comint-source): * pcmpl-linux.el (pcmpl-linux): * shell.el (shell-faces): * eshell/esh-opt.el (eshell-opt): * international/ccl.el (ccl): Remove empty custom groups. * completion.el (dynamic-completion-mode): * jit-lock.el (jit-lock-debug-mode): * minibuffer.el (completion-in-region-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * emulation/tpu-edt.el (tpu-edt-mode): * progmodes/subword.el (global-subword-mode, global-superword-mode): * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode): * term/vt100.el (vt100-wide-mode): Specify explicit :group. * term/xterm.el (xterm): Change parent group to terminals. * master.el (master): Remove empty custom group. (master-mode): Remove unused :group argument. * textmodes/refill.el (refill): Remove empty custom group. (refill-mode): Remove unused :group argument. * textmodes/rst.el (rst-compile-toolsets): Use rst-compile group. * cedet/semantic/symref/list.el (semantic-symref-auto-expand-results) (semantic-symref-results-mode-hook) (semantic-symref-results-summary-function): Fix :group. * erc/erc-list.el (erc-list): * erc/erc-menu.el (erc-menu): * erc/erc-ring.el (erc-ring): Define custom groups, for define-erc-module. * gnus/shr-color.el (shr-color-visible-luminance-min) (shr-color-visible-distance-min): Use shr-color group. * url/url-news.el (url-news): Remove empty custom group.
2013-05-15 23:55:41 +00:00
:global t :group 'type-break)
(define-minor-mode type-break-query-mode
Fix minor mode docstrings for the new meaning of a nil ARG. * abbrev.el (abbrev-mode): * allout.el (allout-mode): * autoinsert.el (auto-insert-mode): * autoarg.el (autoarg-mode, autoarg-kp-mode): * autorevert.el (auto-revert-mode, auto-revert-tail-mode) (global-auto-revert-mode): * battery.el (display-battery-mode): * composite.el (global-auto-composition-mode) (auto-composition-mode): * delsel.el (delete-selection-mode): * desktop.el (desktop-save-mode): * dired-x.el (dired-omit-mode): * dirtrack.el (dirtrack-mode): * doc-view.el (doc-view-minor-mode): * double.el (double-mode): * electric.el (electric-indent-mode, electric-pair-mode): * emacs-lock.el (emacs-lock-mode): * epa-hook.el (auto-encryption-mode): * follow.el (follow-mode): * font-core.el (font-lock-mode): * frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode): * help.el (temp-buffer-resize-mode): * hilit-chg.el (highlight-changes-mode) (highlight-changes-visible-mode): * hi-lock.el (hi-lock-mode): * hl-line.el (hl-line-mode, global-hl-line-mode): * icomplete.el (icomplete-mode): * ido.el (ido-everywhere): * image-file.el (auto-image-file-mode): * image-mode.el (image-minor-mode): * iswitchb.el (iswitchb-mode): * jka-cmpr-hook.el (auto-compression-mode): * linum.el (linum-mode): * longlines.el (longlines-mode): * master.el (master-mode): * mb-depth.el (minibuffer-depth-indicate-mode): * menu-bar.el (menu-bar-mode): * minibuf-eldef.el (minibuffer-electric-default-mode): * mouse-sel.el (mouse-sel-mode): * msb.el (msb-mode): * mwheel.el (mouse-wheel-mode): * outline.el (outline-minor-mode): * paren.el (show-paren-mode): * recentf.el (recentf-mode): * reveal.el (reveal-mode, global-reveal-mode): * rfn-eshadow.el (file-name-shadow-mode): * ruler-mode.el (ruler-mode): * savehist.el (savehist-mode): * scroll-all.el (scroll-all-mode): * scroll-bar.el (scroll-bar-mode): * server.el (server-mode): * shell.el (shell-dirtrack-mode): * simple.el (auto-fill-mode, transient-mark-mode) (visual-line-mode, overwrite-mode, binary-overwrite-mode) (line-number-mode, column-number-mode, size-indication-mode) (auto-save-mode, normal-erase-is-backspace-mode, visible-mode): * strokes.el (strokes-mode): * time.el (display-time-mode): * t-mouse.el (gpm-mouse-mode): * tool-bar.el (tool-bar-mode): * tooltip.el (tooltip-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * view.el (view-mode): * whitespace.el (whitespace-mode, whitespace-newline-mode) (global-whitespace-mode, global-whitespace-newline-mode): * xt-mouse.el (xterm-mouse-mode): Doc fix. * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix autogenerated docstring.
2011-10-19 12:54:24 +00:00
"Toggle typing break queries.
Fix minor mode docstrings for the new meaning of a nil ARG. * abbrev.el (abbrev-mode): * allout.el (allout-mode): * autoinsert.el (auto-insert-mode): * autoarg.el (autoarg-mode, autoarg-kp-mode): * autorevert.el (auto-revert-mode, auto-revert-tail-mode) (global-auto-revert-mode): * battery.el (display-battery-mode): * composite.el (global-auto-composition-mode) (auto-composition-mode): * delsel.el (delete-selection-mode): * desktop.el (desktop-save-mode): * dired-x.el (dired-omit-mode): * dirtrack.el (dirtrack-mode): * doc-view.el (doc-view-minor-mode): * double.el (double-mode): * electric.el (electric-indent-mode, electric-pair-mode): * emacs-lock.el (emacs-lock-mode): * epa-hook.el (auto-encryption-mode): * follow.el (follow-mode): * font-core.el (font-lock-mode): * frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode): * help.el (temp-buffer-resize-mode): * hilit-chg.el (highlight-changes-mode) (highlight-changes-visible-mode): * hi-lock.el (hi-lock-mode): * hl-line.el (hl-line-mode, global-hl-line-mode): * icomplete.el (icomplete-mode): * ido.el (ido-everywhere): * image-file.el (auto-image-file-mode): * image-mode.el (image-minor-mode): * iswitchb.el (iswitchb-mode): * jka-cmpr-hook.el (auto-compression-mode): * linum.el (linum-mode): * longlines.el (longlines-mode): * master.el (master-mode): * mb-depth.el (minibuffer-depth-indicate-mode): * menu-bar.el (menu-bar-mode): * minibuf-eldef.el (minibuffer-electric-default-mode): * mouse-sel.el (mouse-sel-mode): * msb.el (msb-mode): * mwheel.el (mouse-wheel-mode): * outline.el (outline-minor-mode): * paren.el (show-paren-mode): * recentf.el (recentf-mode): * reveal.el (reveal-mode, global-reveal-mode): * rfn-eshadow.el (file-name-shadow-mode): * ruler-mode.el (ruler-mode): * savehist.el (savehist-mode): * scroll-all.el (scroll-all-mode): * scroll-bar.el (scroll-bar-mode): * server.el (server-mode): * shell.el (shell-dirtrack-mode): * simple.el (auto-fill-mode, transient-mark-mode) (visual-line-mode, overwrite-mode, binary-overwrite-mode) (line-number-mode, column-number-mode, size-indication-mode) (auto-save-mode, normal-erase-is-backspace-mode, visible-mode): * strokes.el (strokes-mode): * time.el (display-time-mode): * t-mouse.el (gpm-mouse-mode): * tool-bar.el (tool-bar-mode): * tooltip.el (tooltip-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * view.el (view-mode): * whitespace.el (whitespace-mode, whitespace-newline-mode) (global-whitespace-mode, global-whitespace-newline-mode): * xt-mouse.el (xterm-mouse-mode): Doc fix. * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix autogenerated docstring.
2011-10-19 12:54:24 +00:00
The user may also enable or disable this mode simply by setting
the variable of the same name."
Misc custom group fixes * cus-start.el (show-trailing-whitespace): Move to editing basics. * faces.el (trailing-whitespace): Don't use whitespace-faces group. * obsolete/old-whitespace.el (whitespace-faces): Remove group. (whitespace-highlight): Move to whitespace group. * comint.el (comint-source): * pcmpl-linux.el (pcmpl-linux): * shell.el (shell-faces): * eshell/esh-opt.el (eshell-opt): * international/ccl.el (ccl): Remove empty custom groups. * completion.el (dynamic-completion-mode): * jit-lock.el (jit-lock-debug-mode): * minibuffer.el (completion-in-region-mode): * type-break.el (type-break-mode-line-message-mode) (type-break-query-mode): * emulation/tpu-edt.el (tpu-edt-mode): * progmodes/subword.el (global-subword-mode, global-superword-mode): * progmodes/vhdl-mode.el (vhdl-electric-mode, vhdl-stutter-mode): * term/vt100.el (vt100-wide-mode): Specify explicit :group. * term/xterm.el (xterm): Change parent group to terminals. * master.el (master): Remove empty custom group. (master-mode): Remove unused :group argument. * textmodes/refill.el (refill): Remove empty custom group. (refill-mode): Remove unused :group argument. * textmodes/rst.el (rst-compile-toolsets): Use rst-compile group. * cedet/semantic/symref/list.el (semantic-symref-auto-expand-results) (semantic-symref-results-mode-hook) (semantic-symref-results-summary-function): Fix :group. * erc/erc-list.el (erc-list): * erc/erc-menu.el (erc-menu): * erc/erc-ring.el (erc-ring): Define custom groups, for define-erc-module. * gnus/shr-color.el (shr-color-visible-luminance-min) (shr-color-visible-distance-min): Use shr-color group. * url/url-news.el (url-news): Remove empty custom group.
2013-05-15 23:55:41 +00:00
:global t :group 'type-break)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;;; session file functions
(defvar type-break-auto-save-file-name
(let ((buffer-file-name type-break-file-name))
(make-auto-save-file-name))
"Auto-save name of `type-break-file-name'.")
(defun type-break-file-time (&optional time)
"File break time in `type-break-file-name', unless the file is locked."
(if (and type-break-file-name
(not (stringp (file-locked-p type-break-file-name))))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(with-current-buffer (find-file-noselect type-break-file-name
'nowarn)
(let ((inhibit-read-only t))
(erase-buffer)
(insert (format "%s\n\n" (or time type-break-interval-start)))
;; file saving is left to auto-save
))))
(defun type-break-file-keystroke-count ()
"File keystroke count in `type-break-file-name', unless the file is locked."
(if (and type-break-file-name
(not (stringp (file-locked-p type-break-file-name))))
;; Prevent deactivation of the mark in some other buffer.
(let (deactivate-mark)
(with-current-buffer (find-file-noselect type-break-file-name
'nowarn)
(save-excursion
(let ((inhibit-read-only t))
(goto-char (point-min))
(forward-line)
Use line-end-position rather than end-of-line, etc. * textmodes/texnfo-upd.el (texinfo-start-menu-description) (texinfo-update-menu-region-beginning, texinfo-menu-first-node) (texinfo-delete-existing-pointers, texinfo-find-pointer) (texinfo-clean-up-node-line, texinfo-insert-node-lines) (texinfo-multiple-files-update): * textmodes/table.el (table--probe-cell-left-up) (table--probe-cell-right-bottom): * textmodes/picture.el (picture-tab-search): * textmodes/page-ext.el (pages-copy-header-and-position) (pages-directory-for-addresses): * progmodes/vera-mode.el (vera-get-offset): * progmodes/simula.el (simula-calculate-indent): * progmodes/python.el (python-pdbtrack-overlay-arrow): * progmodes/prolog.el (end-of-prolog-clause): * progmodes/perl-mode.el (perl-calculate-indent, perl-indent-exp): * progmodes/icon.el (indent-icon-exp): * progmodes/etags.el (tag-re-match-p): * progmodes/ebrowse.el (ebrowse-show-file-name-at-point): * progmodes/ebnf2ps.el (ebnf-begin-file): * progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-save-local-variable): * play/life.el (life-setup): * play/gametree.el (gametree-looking-at-ply): * nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set): * mail/sendmail.el (mail-mode-auto-fill): * emacs-lisp/lisp-mode.el (calculate-lisp-indent): * emacs-lisp/edebug.el (edebug-overlay-arrow): * emacs-lisp/checkdoc.el (checkdoc-this-string-valid): * woman.el (woman-parse-numeric-value, woman2-TH, woman2-SH) (woman-tab-to-tab-stop, WoMan-warn-ignored): * type-break.el (type-break-file-keystroke-count): * term.el (term-replace-by-expanded-history-before-point) (term-skip-prompt, term-extract-string): * speedbar.el (speedbar-edit-line, speedbar-expand-line) (speedbar-contract-line, speedbar-toggle-line-expansion) (speedbar-parse-c-or-c++tag, speedbar-parse-tex-string) (speedbar-buffer-revert-buffer, speedbar-highlight-one-tag-line): * sort.el (sort-skip-fields): * skeleton.el (skeleton-internal-list): * simple.el (line-move-finish, line-move-to-column): * shell.el (shell-forward-command): * misc.el (copy-from-above-command): * makesum.el (double-column): * ebuff-menu.el (electric-buffer-update-highlight): * dired.el (dired-move-to-end-of-filename): * dframe.el (dframe-popup-kludge): * bookmark.el (bookmark-kill-line, bookmark-bmenu-show-filenames): * arc-mode.el (archive-get-lineno): Use line-end-position and line-beginning-position. * net/ange-ftp.el, progmodes/hideif.el, reposition.el: Same, but only in comments.
2010-11-06 20:23:42 +00:00
(delete-region (point) (line-end-position))
(insert (format "%s" type-break-keystroke-count))
;; file saving is left to auto-save
))))))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defun type-break-timep (time)
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
"If TIME is a Lisp time value then return TIME, else return nil."
(condition-case nil
(and (float-time time) time)
(error nil)))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defun type-break-choose-file ()
"Return file to read from."
(cond
((not type-break-file-name)
nil)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
((and (file-exists-p type-break-auto-save-file-name)
(file-readable-p type-break-auto-save-file-name))
type-break-auto-save-file-name)
((and (file-exists-p type-break-file-name)
(file-readable-p type-break-file-name))
type-break-file-name)
(t nil)))
(defun type-break-get-previous-time ()
"Get previous break time from `type-break-file-name'.
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
Return nil if the file is missing or if the time is not a Lisp time value."
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(let ((file (type-break-choose-file)))
(if file
(type-break-timep ;; returns expected format, else nil
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(with-current-buffer (find-file-noselect file 'nowarn)
(condition-case nil
(save-excursion
(goto-char (point-min))
(read (current-buffer)))
(end-of-file
(warn "End of file in `%s'" file))))))))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defun type-break-get-previous-count ()
"Get previous keystroke count from `type-break-file-name'.
Return 0 if the file is missing or if the form read is not an
integer."
(let ((file (type-break-choose-file)))
(if (and file
(integerp
(setq file
(with-current-buffer
(find-file-noselect file 'nowarn)
(condition-case nil
(save-excursion
(goto-char (point-min))
(forward-line 1)
(read (current-buffer)))
(end-of-file
(warn "End of file in `%s'" file)))))))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
file
0)))
1994-02-14 00:41:56 +00:00
;;;###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'."
1994-02-14 00:41:56 +00:00
(interactive)
(do-auto-save)
(type-break-cancel-schedule)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;; remove any query scheduled during interactive invocation
(remove-hook 'type-break-post-command-hook 'type-break-do-query)
(let ((continue t)
(start-time (time-convert nil 'integer)))
(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))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(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))))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(let ((good-interval (or type-break-good-rest-interval
type-break-good-break-interval)))
(cond
(good-interval
(let ((break-secs (type-break-time-difference
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
start-time nil)))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(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)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(type-break-file-time)
(type-break-mode-line-countdown-or-break nil)
(type-break-schedule))
1994-02-14 00:41:56 +00:00
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(defun type-break-schedule (&optional time start interval)
"Schedule a typing break for TIME seconds from now.
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
If time is not specified it defaults to `type-break-interval'.
START and INTERVAL are used when recovering a break.
START is the start of the break (defaults to now).
INTERVAL is the full length of an interval (defaults to TIME)."
(interactive (list (and current-prefix-arg
(prefix-numeric-value current-prefix-arg))))
(or time (setq time type-break-interval))
(type-break-check-post-command-hook)
(type-break-cancel-schedule)
(type-break-time-warning-schedule time 'reset)
(run-at-time (max 1 time) nil 'type-break-alarm)
(setq type-break-time-next-break
Improve time stamp handling, and be more consistent about it. This implements a suggestion made in: http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00587.html Among other things, this means timer.el no longer needs to autoload the time-date module. * doc/lispref/os.texi (Time of Day, Time Conversion, Time Parsing) (Processor Run Time, Time Calculations): Document the new behavior, plus be clearer about the old behavior. (Idle Timers): Take advantage of new functionality. * etc/NEWS: Document the changes. * lisp/allout-widgets.el (allout-elapsed-time-seconds): Doc fix. * lisp/arc-mode.el (archive-ar-summarize): * lisp/calendar/time-date.el (seconds-to-time, days-to-time, time-since): * lisp/emacs-lisp/timer.el (timer-relative-time, timer-event-handler) (run-at-time, with-timeout-suspend, with-timeout-unsuspend): * lisp/net/tramp.el (tramp-time-less-p, tramp-time-subtract): * lisp/proced.el (proced-time-lessp): * lisp/timezone.el (timezone-time-from-absolute): * lisp/type-break.el (type-break-schedule, type-break-time-sum): Simplify by using new functionality. * lisp/calendar/cal-dst.el (calendar-next-time-zone-transition): Do not return time values in obsolete and undocumented (HI . LO) format; use (HI LO) instead. * lisp/calendar/time-date.el (with-decoded-time-value): Treat 'nil' as current time. This is mostly for XEmacs. (encode-time-value, with-decoded-time-value): Obsolete. (time-add, time-subtract, time-less-p): Use no-op autoloads, for XEmacs. Define only if XEmacs, as they're now C builtins in Emacs. * lisp/ldefs-boot.el: Update to match new time-date.el * lisp/proced.el: Do not require time-date. * src/editfns.c (invalid_time): New function. Use it instead of 'error ("Invalid time specification")'. (time_add, time_subtract, time_arith, Ftime_add, Ftime_less_p) (decode_float_time, lisp_to_timespec, lisp_time_struct): New functions. (make_time_tail, make_time): Remove. All uses changed to use new functions or plain list4i. (disassemble_lisp_time): Return effective length if successful. Check that LOW is an integer, if it's combined with other components. (decode_time_components): Decode into struct lisp_time, not struct timespec, so that we can support a wide set of times regardless of whether time_t is signed. Decode plain numbers as seconds since the Epoch, and nil as the current time. (lisp_time_argument, lisp_seconds_argument, Ffloat_time): Reimplement in terms of new functions. (Fencode_time): Just use list2i. (syms_of_editfns): Add time-add, time-subtract, time-less-p. * src/keyboard.c (decode_timer): Don't allow the new formats (floating point or nil) in timers. * src/systime.h (LO_TIME_BITS): New constant. Use it everywhere in place of the magic number '16'. (struct lisp_time): New type. (decode_time_components): Use it. (lisp_to_timespec): New decl.
2014-11-17 04:38:15 +00:00
(type-break-time-sum start (or interval time))))
1994-02-14 00:41:56 +00:00
(defun type-break-cancel-schedule ()
(type-break-cancel-time-warning-schedule)
(cancel-function-timers 'type-break-alarm)
(setq type-break-alarm-p nil)
(setq type-break-time-next-break nil))
(defun type-break-time-warning-schedule (&optional time resetp)
(let ((type-break-current-time-warning-interval nil))
(type-break-cancel-time-warning-schedule))
(add-hook 'type-break-post-command-hook 'type-break-time-warning 'append)
(cond
(type-break-time-warning-intervals
(and resetp
(setq type-break-current-time-warning-interval
type-break-time-warning-intervals))
(or time
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
(setq time (type-break-time-difference nil
type-break-time-next-break)))
(while (and type-break-current-time-warning-interval
(> (car type-break-current-time-warning-interval) time))
(setq type-break-current-time-warning-interval
(cdr type-break-current-time-warning-interval)))
(cond
(type-break-current-time-warning-interval
(setq time (- time (car type-break-current-time-warning-interval)))
(setq type-break-current-time-warning-interval
(cdr type-break-current-time-warning-interval))
;(let (type-break-current-time-warning-interval)
; (type-break-cancel-time-warning-schedule))
(run-at-time (max 1 time) nil 'type-break-time-warning-alarm)
(cond
(resetp
(setq type-break-warning-countdown-string nil))
(t
(setq type-break-warning-countdown-string (number-to-string time))
(setq type-break-warning-countdown-string-type "seconds"))))))))
(defun type-break-cancel-time-warning-schedule ()
(cancel-function-timers 'type-break-time-warning-alarm)
(remove-hook 'type-break-post-command-hook 'type-break-time-warning)
(setq type-break-current-time-warning-interval
type-break-time-warning-intervals)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(setq type-break-time-warning-count 0) ; avoid warnings after break
(setq type-break-warning-countdown-string nil))
(defun type-break-alarm ()
(type-break-check-post-command-hook)
(setq type-break-alarm-p t)
(type-break-mode-line-countdown-or-break 'break))
(defun type-break-time-warning-alarm ()
(type-break-check-post-command-hook)
(type-break-time-warning-schedule)
(setq type-break-time-warning-count type-break-warning-repeat)
(type-break-time-warning)
(type-break-mode-line-countdown-or-break 'countdown))
(defun type-break-run-tb-post-command-hook ()
(and type-break-mode
(run-hooks 'type-break-post-command-hook)))
(defun type-break-check ()
"Ask to take a typing break if appropriate.
This may be the case either because the scheduled time has come \(and the
minimum keystroke threshold has been reached) or because the maximum
keystroke threshold has been exceeded."
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(type-break-file-keystroke-count)
(let* ((min-threshold (car type-break-keystroke-threshold))
(max-threshold (cdr type-break-keystroke-threshold)))
(and type-break-good-rest-interval
(progn
(and (> (type-break-time-difference
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
type-break-time-last-command nil)
type-break-good-rest-interval)
(progn
(type-break-keystroke-reset)
(type-break-mode-line-countdown-or-break nil)
(setq type-break-time-last-break (time-convert nil 'integer))
(type-break-schedule)))
(setq type-break-time-last-command (time-convert nil 'integer))))
(and type-break-keystroke-threshold
(let ((keys (this-command-keys)))
(cond
;; Ignore mouse motion
((and (vectorp keys)
(consp (aref keys 0))
(memq (car (aref keys 0)) '(mouse-movement))))
(t
(setq type-break-keystroke-count
(+ type-break-keystroke-count (length keys)))))))
(cond
(type-break-alarm-p
(cond
((input-pending-p))
((eq (selected-window) (minibuffer-window)))
((and min-threshold
(< type-break-keystroke-count min-threshold))
(type-break-schedule))
(t
;; If keystroke count is within min-threshold of
;; max-threshold, lower it to reduce the likelihood of an
;; immediate subsequent query.
(and max-threshold
min-threshold
(< (- max-threshold type-break-keystroke-count) min-threshold)
(progn
(type-break-keystroke-reset)
(setq type-break-keystroke-count min-threshold)))
(type-break-query))))
((and type-break-keystroke-warning-intervals
max-threshold
(= type-break-keystroke-warning-count 0)
(type-break-check-keystroke-warning)))
((and max-threshold
(> type-break-keystroke-count max-threshold)
(not (input-pending-p))
(not (eq (selected-window) (minibuffer-window))))
(type-break-keystroke-reset)
(setq type-break-keystroke-count (or min-threshold 0))
(type-break-query)))))
;; This should return t if warnings were enabled, nil otherwise.
(defun type-break-check-keystroke-warning ()
;; This is safe because the caller should have checked that the cdr was
;; non-nil already.
(let ((left (- (cdr type-break-keystroke-threshold)
type-break-keystroke-count)))
(cond
((null (car type-break-current-keystroke-warning-interval))
nil)
((> left (car type-break-current-keystroke-warning-interval))
nil)
(t
(while (and (car type-break-current-keystroke-warning-interval)
(< left (car type-break-current-keystroke-warning-interval)))
(setq type-break-current-keystroke-warning-interval
(cdr type-break-current-keystroke-warning-interval)))
(setq type-break-keystroke-warning-count type-break-warning-repeat)
(add-hook 'type-break-post-command-hook 'type-break-keystroke-warning)
(setq type-break-warning-countdown-string (number-to-string left))
(setq type-break-warning-countdown-string-type "keystrokes")
(type-break-mode-line-countdown-or-break 'countdown)
t))))
;; Arrange for a break query to be made, when the user stops typing furiously.
(defun type-break-query ()
(add-hook 'type-break-post-command-hook 'type-break-do-query))
(defun type-break-do-query ()
(cond
((not type-break-query-mode)
(type-break-noninteractive-query)
(type-break-schedule type-break-query-interval)
(remove-hook 'type-break-post-command-hook 'type-break-do-query))
((sit-for 2)
(condition-case ()
(cond
((let ((type-break-mode nil)
;; yes-or-no-p sets this-command to exit-minibuffer,
;; which hoses undo or yank-pop (if you happened to be
;; yanking just when the query occurred).
(this-command this-command))
;; Cancel schedule to prevent possibility of a second query
;; from taking place before this one has even returned.
;; The condition-case wrapper will reschedule on quit.
(type-break-cancel-schedule)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;; Also prevent a second query when the break is interrupted.
(remove-hook 'type-break-post-command-hook 'type-break-do-query)
(funcall type-break-query-function
(format "%s%s"
(type-break-time-stamp)
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(if type-break-terse-messages
"Break now? "
"Take a break from typing now? "))))
(type-break))
(t
(type-break-schedule type-break-query-interval)))
(quit
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(type-break-schedule type-break-query-interval))))))
2011-04-19 13:44:55 +00:00
(defun type-break-noninteractive-query (&optional _ignored-args)
"Null query function which doesn't interrupt user and assumes `no'.
It prints a reminder in the echo area to take a break, but doesn't enforce
this or ask the user to start one right now."
(cond
(type-break-mode-line-message-mode)
(t
(beep t)
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
(message "%sYou should take a typing break now. Do `%s'."
(type-break-time-stamp)
(substitute-command-keys "\\[type-break]"))
(sit-for 1)
(beep t)
;; return nil so query caller knows to reset reminder, as if user
;; said "no" in response to yes-or-no-p.
nil)))
(defun type-break-time-warning ()
(cond
((and (car type-break-keystroke-threshold)
(< type-break-keystroke-count (car type-break-keystroke-threshold))))
((> type-break-time-warning-count 0)
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
(let ((timeleft (type-break-time-difference nil
type-break-time-next-break)))
(setq type-break-warning-countdown-string (number-to-string timeleft))
(cond
((eq (selected-window) (minibuffer-window)))
;; Do nothing if the command was just a prefix arg, since that will
;; immediately be followed by some other interactive command.
;; Otherwise, it is particularly annoying for the sit-for below to
;; delay redisplay when one types sequences like `C-u -1 C-l'.
((memq this-command '(digit-argument universal-argument)))
((not type-break-mode-line-message-mode)
;; Pause for a moment so any previous message can be seen.
(sit-for 2)
(message "%sWarning: typing break due in %s."
(type-break-time-stamp)
(type-break-format-time timeleft))
(setq type-break-time-warning-count
(1- type-break-time-warning-count))))))
(t
(remove-hook 'type-break-post-command-hook 'type-break-time-warning)
(setq type-break-warning-countdown-string nil))))
(defun type-break-keystroke-warning ()
(cond
((> type-break-keystroke-warning-count 0)
(setq type-break-warning-countdown-string
(number-to-string (- (cdr type-break-keystroke-threshold)
type-break-keystroke-count)))
(cond
((eq (selected-window) (minibuffer-window)))
;; Do nothing if the command was just a prefix arg, since that will
;; immediately be followed by some other interactive command.
;; Otherwise, it is particularly annoying for the sit-for below to
;; delay redisplay when one types sequences like `C-u -1 C-l'.
((memq this-command '(digit-argument universal-argument)))
((not type-break-mode-line-message-mode)
(sit-for 2)
(message "%sWarning: typing break due in %s keystrokes."
(type-break-time-stamp)
(- (cdr type-break-keystroke-threshold)
type-break-keystroke-count))
(setq type-break-keystroke-warning-count
(1- type-break-keystroke-warning-count)))))
(t
(remove-hook 'type-break-post-command-hook
'type-break-keystroke-warning)
(setq type-break-warning-countdown-string nil))))
(defun type-break-mode-line-countdown-or-break (&optional type)
(cond
((not type-break-mode-line-message-mode))
((eq type 'countdown)
;(setq type-break-mode-line-break-message-p nil)
(add-hook 'type-break-post-command-hook
'type-break-force-mode-line-update 'append))
((eq type 'break)
;; Alternate
(setq type-break-mode-line-break-message-p
(not type-break-mode-line-break-message-p))
(remove-hook 'type-break-post-command-hook
'type-break-force-mode-line-update))
(t
(setq type-break-mode-line-break-message-p nil)
(setq type-break-warning-countdown-string nil)
(remove-hook 'type-break-post-command-hook
'type-break-force-mode-line-update)))
(type-break-force-mode-line-update))
;;;###autoload
(defun type-break-statistics ()
"Print statistics about typing breaks in a temporary buffer.
This includes the last time a typing break was taken, when the next one is
scheduled, the keystroke thresholds and the current keystroke count, etc."
(interactive)
(with-output-to-temp-buffer "*Typing Break Statistics*"
(princ (format "Typing break statistics\n-----------------------\n
Typing break mode is currently %s.
Interactive query for breaks is %s.
Warnings of imminent typing breaks in mode line is %s.
Last typing break ended : %s
Next scheduled typing break : %s\n
Minimum keystroke threshold : %s
Maximum keystroke threshold : %s
Current keystroke count : %s"
(if type-break-mode "enabled" "disabled")
(if type-break-query-mode "enabled" "disabled")
(if type-break-mode-line-message-mode "enabled" "disabled")
(if type-break-time-last-break
(current-time-string type-break-time-last-break)
"never")
(if (and type-break-mode type-break-time-next-break)
(format "%s\t(%s from now)"
(current-time-string type-break-time-next-break)
(type-break-format-time
(type-break-time-difference
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
nil
type-break-time-next-break)))
"none scheduled")
(or (car type-break-keystroke-threshold) "none")
(or (cdr type-break-keystroke-threshold) "none")
type-break-keystroke-count))))
;;;###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.
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
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))
;;; misc functions
;; 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))))
Improve time stamp handling, and be more consistent about it. This implements a suggestion made in: http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00587.html Among other things, this means timer.el no longer needs to autoload the time-date module. * doc/lispref/os.texi (Time of Day, Time Conversion, Time Parsing) (Processor Run Time, Time Calculations): Document the new behavior, plus be clearer about the old behavior. (Idle Timers): Take advantage of new functionality. * etc/NEWS: Document the changes. * lisp/allout-widgets.el (allout-elapsed-time-seconds): Doc fix. * lisp/arc-mode.el (archive-ar-summarize): * lisp/calendar/time-date.el (seconds-to-time, days-to-time, time-since): * lisp/emacs-lisp/timer.el (timer-relative-time, timer-event-handler) (run-at-time, with-timeout-suspend, with-timeout-unsuspend): * lisp/net/tramp.el (tramp-time-less-p, tramp-time-subtract): * lisp/proced.el (proced-time-lessp): * lisp/timezone.el (timezone-time-from-absolute): * lisp/type-break.el (type-break-schedule, type-break-time-sum): Simplify by using new functionality. * lisp/calendar/cal-dst.el (calendar-next-time-zone-transition): Do not return time values in obsolete and undocumented (HI . LO) format; use (HI LO) instead. * lisp/calendar/time-date.el (with-decoded-time-value): Treat 'nil' as current time. This is mostly for XEmacs. (encode-time-value, with-decoded-time-value): Obsolete. (time-add, time-subtract, time-less-p): Use no-op autoloads, for XEmacs. Define only if XEmacs, as they're now C builtins in Emacs. * lisp/ldefs-boot.el: Update to match new time-date.el * lisp/proced.el: Do not require time-date. * src/editfns.c (invalid_time): New function. Use it instead of 'error ("Invalid time specification")'. (time_add, time_subtract, time_arith, Ftime_add, Ftime_less_p) (decode_float_time, lisp_to_timespec, lisp_time_struct): New functions. (make_time_tail, make_time): Remove. All uses changed to use new functions or plain list4i. (disassemble_lisp_time): Return effective length if successful. Check that LOW is an integer, if it's combined with other components. (decode_time_components): Decode into struct lisp_time, not struct timespec, so that we can support a wide set of times regardless of whether time_t is signed. Decode plain numbers as seconds since the Epoch, and nil as the current time. (lisp_time_argument, lisp_seconds_argument, Ffloat_time): Reimplement in terms of new functions. (Fencode_time): Just use list2i. (syms_of_editfns): Add time-add, time-subtract, time-less-p. * src/keyboard.c (decode_timer): Don't allow the new formats (floating point or nil) in timers. * src/systime.h (LO_TIME_BITS): New constant. Use it everywhere in place of the magic number '16'. (struct lisp_time): New type. (decode_time_components): Use it. (lisp_to_timespec): New decl.
2014-11-17 04:38:15 +00:00
;; Return a time value that is the sum of the time-value arguments.
(defun type-break-time-sum (&rest tmlist)
(let ((sum 0))
(dolist (tem tmlist)
Improve time stamp handling, and be more consistent about it. This implements a suggestion made in: http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00587.html Among other things, this means timer.el no longer needs to autoload the time-date module. * doc/lispref/os.texi (Time of Day, Time Conversion, Time Parsing) (Processor Run Time, Time Calculations): Document the new behavior, plus be clearer about the old behavior. (Idle Timers): Take advantage of new functionality. * etc/NEWS: Document the changes. * lisp/allout-widgets.el (allout-elapsed-time-seconds): Doc fix. * lisp/arc-mode.el (archive-ar-summarize): * lisp/calendar/time-date.el (seconds-to-time, days-to-time, time-since): * lisp/emacs-lisp/timer.el (timer-relative-time, timer-event-handler) (run-at-time, with-timeout-suspend, with-timeout-unsuspend): * lisp/net/tramp.el (tramp-time-less-p, tramp-time-subtract): * lisp/proced.el (proced-time-lessp): * lisp/timezone.el (timezone-time-from-absolute): * lisp/type-break.el (type-break-schedule, type-break-time-sum): Simplify by using new functionality. * lisp/calendar/cal-dst.el (calendar-next-time-zone-transition): Do not return time values in obsolete and undocumented (HI . LO) format; use (HI LO) instead. * lisp/calendar/time-date.el (with-decoded-time-value): Treat 'nil' as current time. This is mostly for XEmacs. (encode-time-value, with-decoded-time-value): Obsolete. (time-add, time-subtract, time-less-p): Use no-op autoloads, for XEmacs. Define only if XEmacs, as they're now C builtins in Emacs. * lisp/ldefs-boot.el: Update to match new time-date.el * lisp/proced.el: Do not require time-date. * src/editfns.c (invalid_time): New function. Use it instead of 'error ("Invalid time specification")'. (time_add, time_subtract, time_arith, Ftime_add, Ftime_less_p) (decode_float_time, lisp_to_timespec, lisp_time_struct): New functions. (make_time_tail, make_time): Remove. All uses changed to use new functions or plain list4i. (disassemble_lisp_time): Return effective length if successful. Check that LOW is an integer, if it's combined with other components. (decode_time_components): Decode into struct lisp_time, not struct timespec, so that we can support a wide set of times regardless of whether time_t is signed. Decode plain numbers as seconds since the Epoch, and nil as the current time. (lisp_time_argument, lisp_seconds_argument, Ffloat_time): Reimplement in terms of new functions. (Fencode_time): Just use list2i. (syms_of_editfns): Add time-add, time-subtract, time-less-p. * src/keyboard.c (decode_timer): Don't allow the new formats (floating point or nil) in timers. * src/systime.h (LO_TIME_BITS): New constant. Use it everywhere in place of the magic number '16'. (struct lisp_time): New type. (decode_time_components): Use it. (lisp_to_timespec): New decl.
2014-11-17 04:38:15 +00:00
(setq sum (time-add sum tem)))
sum))
(defun type-break-time-stamp (&optional when)
(format-time-string type-break-time-stamp-format when))
(defun type-break-format-time (secs)
(let ((mins (/ secs 60)))
(cond
((= mins 1) (format "%d minute" mins))
((> mins 0) (format "%d minutes" mins))
((= secs 1) (format "%d second" secs))
(t (format "%d seconds" secs)))))
(defun type-break-keystroke-reset ()
(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
type-break-keystroke-warning-intervals)
(remove-hook 'type-break-post-command-hook 'type-break-keystroke-warning))
(defun type-break-force-mode-line-update (&optional all)
"Force the mode-line of the current buffer to be redisplayed.
With optional non-nil ALL, force redisplay of all mode-lines."
* x-dnd.el (x-dnd-maybe-call-test-function): * window.el (split-window-vertically): * whitespace.el (whitespace-help-on): * vc-rcs.el (vc-rcs-consult-headers): * userlock.el (ask-user-about-lock-help) (ask-user-about-supersession-help): * type-break.el (type-break-force-mode-line-update): * time-stamp.el (time-stamp-conv-warn): * terminal.el (te-set-output-log, te-more-break, te-filter) (te-sentinel,terminal-emulator): * term.el (make-term, term-exec, term-sentinel, term-read-input-ring) (term-write-input-ring, term-check-source, term-start-output-log): (term-display-buffer-line, term-dynamic-list-completions): (term-ansi-make-term, serial-term): * subr.el (selective-display): * strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer) (strokes-encode-buffer, strokes-xpm-for-compressed-string): * speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info) (speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support) (speedbar-remove-localized-speedbar-support) (speedbar-set-mode-line-format, speedbar-create-tag-hierarchy) (speedbar-update-special-contents, speedbar-buffer-buttons-engine) (speedbar-buffers-line-directory): * simple.el (shell-command-on-region, append-to-buffer) (prepend-to-buffer): * shadowfile.el (shadow-save-todo-file): * scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1) (scroll-bar-maybe-set-window-start): * sb-image.el (speedbar-image-dump): * saveplace.el (save-place-alist-to-file, save-places-to-alist) (load-save-place-alist-from-file): * ps-samp.el (ps-print-message-from-summary): * ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox) (ps-background-image, ps-begin-job, ps-do-despool): * ps-bdf.el (bdf-find-file, bdf-read-font-info): * printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting) (pr-ps-message-from-summary, pr-lpr-message-from-summary): (pr-call-process, pr-file-list, pr-interface-save): * novice.el (disabled-command-function) (enable-command, disable-command): * mouse.el (mouse-buffer-menu-alist): * mouse-copy.el (mouse-kill-preserving-secondary): * macros.el (kbd-macro-query): * ledit.el (ledit-go-to-lisp, ledit-go-to-liszt): * informat.el (batch-info-validate): * ido.el (ido-copy-current-word, ido-initiate-auto-merge): * hippie-exp.el (try-expand-dabbrev-visible): * help-mode.el (help-make-xrefs): * help-fns.el (describe-variable): * generic-x.el (bat-generic-mode-run-as-comint): * finder.el (finder-mouse-select): * find-dired.el (find-dired-sentinel): * filesets.el (filesets-file-close): * files.el (list-directory): * faces.el (list-faces-display, describe-face): * facemenu.el (list-colors-display): * ezimage.el (ezimage-image-association-dump, ezimage-image-dump): * epg.el (epg--process-filter, epg-cancel): * epa.el (epa--marked-keys, epa--select-keys, epa-display-info) (epa--read-signature-type): * emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B) (emerge-file-names): * ehelp.el (electric-helpify): * ediff.el (ediff-regions-wordwise, ediff-regions-linewise): * ediff-vers.el (rcs-ediff-view-revision): * ediff-util.el (ediff-setup): * ediff-mult.el (ediff-append-custom-diff): * ediff-diff.el (ediff-exec-process, ediff-process-sentinel) (ediff-wordify): * echistory.el (Electric-command-history-redo-expression): * dos-w32.el (find-file-not-found-set-buffer-file-coding-system): * disp-table.el (describe-display-table): * dired.el (dired-find-buffer-nocreate): * dired-aux.el (dired-rename-subdir, dired-dwim-target-directory): * dabbrev.el (dabbrev--same-major-mode-p): * chistory.el (list-command-history): * apropos.el (apropos-documentation): * allout.el (allout-obtain-passphrase): (allout-copy-exposed-to-buffer): (allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
(and all (with-current-buffer (other-buffer)))
(set-buffer-modified-p (buffer-modified-p)))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
;; If an exception occurs in Emacs while running the post command hook, the
;; value of that hook is clobbered. This is because the value of the
;; variable is temporarily set to nil while it's running to prevent
;; recursive application, but it also means an exception aborts the routine
;; of restoring it. This function is called from the timers to restore it,
;; just in case.
(defun type-break-check-post-command-hook ()
(add-hook 'post-command-hook 'type-break-run-tb-post-command-hook 'append))
;;; Demo wrappers
(defun type-break-catch-up-event ()
;; If the last input event is a down-event, read and discard the
;; corresponding up-event too, to avoid triggering another prompt.
(and (eventp last-input-event)
(memq 'down (event-modifiers last-input-event))
(read-event)))
;; This is a wrapper around hanoi that calls it with an arg large enough to
;; make the largest discs possible that will fit in the window.
;; Also, clean up the *Hanoi* buffer after we're done.
(defun type-break-demo-hanoi ()
"Take a hanoiing typing break."
(and (get-buffer "*Hanoi*")
(kill-buffer "*Hanoi*"))
(condition-case ()
(progn
(hanoi (/ (window-width) 8))
;; Wait for user to come back.
(read-event)
(type-break-catch-up-event)
(kill-buffer "*Hanoi*"))
(quit
(read-event)
(type-break-catch-up-event)
(and (get-buffer "*Hanoi*")
(kill-buffer "*Hanoi*")))))
;; This is a wrapper around life that calls it with a `sleep' arg to make
;; it run a little more leisurely.
;; Also, clean up the *Life* buffer after we're done.
(defun type-break-demo-life ()
"Take a typing break and get a life."
(let ((continue t))
(while continue
(setq continue nil)
(and (get-buffer "*Life*")
(kill-buffer "*Life*"))
(condition-case ()
(progn
(life 3)
;; wait for user to return
(read-event)
(type-break-catch-up-event)
(kill-buffer "*Life*"))
(life-extinct
(message "%s" (get 'life-extinct 'error-message))
;; restart demo
(setq continue t))
(quit
(type-break-catch-up-event)
(and (get-buffer "*Life*")
(kill-buffer "*Life*")))))))
;; Boring demo, but doesn't use many cycles
(defun type-break-demo-boring ()
"Boring typing break demo."
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(let ((rmsg (if type-break-terse-messages
""
"Press any key to resume from typing break"))
(buffer-name "*Typing Break Buffer*")
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
lines elapsed timeleft tmsg)
(condition-case ()
(progn
(switch-to-buffer (get-buffer-create buffer-name))
(buffer-disable-undo (current-buffer))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(setq lines (/ (window-body-height) 2))
(unless type-break-terse-messages (setq lines (1- lines)))
(if type-break-demo-boring-stats
(setq lines (- lines 2)))
(setq lines (make-string lines ?\C-j))
(while (not (input-pending-p))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(erase-buffer)
(setq elapsed (type-break-time-difference
type-break-time-last-break
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
nil))
Capitalise Emacs and Lisp. (type-break-good-break-interval, type-break-demo-boring-stats) (type-break-terse-messages, type-break-file-name): New defcustoms. (type-break-post-command-hook) (type-break-warning-countdown-string): Quote variable names in doc. (type-break-interval-start, type-break-auto-save-file-name): New defvars. (type-break-mode): Document type-break-good-break-interval and the "session" file. Schedule break according to the session file. Kill session file buffer on exit. Organise for save-some-buffers to always save the session file. (type-break-mode-line-message-mode, type-break-query-mode): Uppercase arguments. (type-break-file-time, type-break-file-keystroke-count, timep) (type-break-choose-file, type-break-get-previous-time) (type-break-get-previous-count): New defuns. (type-break): Avoid break querying after a completed break in the case where the query was initiated during user invocation of the break. Optional terse messages. Use type-break-good-break-interval if type-break-good-rest-interval is nil. File the break time. (type-break-schedule): New optional args for overriding the use of the current time. (type-break-cancel-time-warning-schedule): Avoid leftover warnings after a break. (type-break-check): File the keystroke count. (type-break-do-query): Prevent a second query when the break is interrupted. Optional terse message. (type-break-keystroke-reset): Record the start of a typing interval. (type-break-demo-boring): Optional terse messages. Display word per minute and keystroke counts according to type-break-demo-boring-stats.
2004-04-27 13:12:07 +00:00
(let ((good-interval (or type-break-good-rest-interval
type-break-good-break-interval)))
(cond
(good-interval
(setq timeleft (- good-interval elapsed))
(if (> timeleft 0)
(setq tmsg
(format (if type-break-terse-messages
"Break remaining: %s"
"You should rest for %s more")
(type-break-format-time timeleft)))
(setq tmsg
(format (if type-break-terse-messages
"Break complete (%s elapsed in total)"
"Typing break has lasted %s")
(type-break-format-time elapsed)))))
(t
(setq tmsg
(format (if type-break-terse-messages
"Break has lasted %s"
"Typing break has lasted %s")
(type-break-format-time elapsed))))))
(insert lines
(make-string (/ (- (window-width) (length tmsg)) 2) ?\ )
tmsg)
(if (> (length rmsg) 0)
(insert "\n"
(make-string (/ (- (window-width) (length rmsg)) 2)
?\ )
rmsg))
(if type-break-demo-boring-stats
(let*
((message
(format
(if type-break-terse-messages
"Since last break: %s keystrokes\n"
"Since your last break you've typed %s keystrokes\n")
type-break-keystroke-count))
(column-spaces
(make-string (/ (- (window-width) (length message)) 2)
?\ ))
(wpm (/ (/ (float type-break-keystroke-count) 5)
(/ (type-break-time-difference
type-break-interval-start
type-break-time-last-break)
60.0))))
(insert "\n\n" column-spaces message)
(if type-break-terse-messages
(insert (format " %s%.2f wpm"
column-spaces
wpm))
(setq message
(format "at an average of %.2f words per minute"
wpm))
(insert
(make-string (/ (- (window-width) (length message)) 2)
?\ )
message))))
(goto-char (point-min))
(sit-for 60))
(read-event)
(type-break-catch-up-event)
(kill-buffer buffer-name))
(quit
(and (get-buffer buffer-name)
(kill-buffer buffer-name))))))
(define-obsolete-function-alias 'timep 'type-break-timep "29.1")
(define-obsolete-function-alias 'type-break-run-at-time #'run-at-time "30.1")
(define-obsolete-function-alias 'type-break-cancel-function-timers #'cancel-function-timers "30.1")
(provide 'type-break)
(if type-break-mode
(type-break-mode 1))
;;; type-break.el ends here