2012-09-28 15:17:08 +00:00
|
|
|
|
;;; type-break.el --- encourage rests from typing at appropriate intervals -*- lexical-binding: t -*-
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
2022-01-01 07:45:51 +00:00
|
|
|
|
;; Copyright (C) 1994-1995, 1997, 2000-2022 Free Software Foundation,
|
2015-01-01 22:26:41 +00:00
|
|
|
|
;; Inc.
|
1994-10-06 19:12:46 +00:00
|
|
|
|
|
2019-05-26 07:58:27 +00:00
|
|
|
|
;; Author: Noah Friedman <friedman@splode.com>
|
1994-10-06 19:12:46 +00:00
|
|
|
|
;; Keywords: extensions, timers
|
|
|
|
|
;; Created: 1994-07-13
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
1994-10-06 19:12:46 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1994-10-06 19:12:46 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1994-10-06 19:12:46 +00:00
|
|
|
|
|
|
|
|
|
;; 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
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; The docstring for the function `type-break-mode' summarizes most of the
|
|
|
|
|
;; details of the interface.
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
;; This package relies on the assumption that you live entirely in Emacs,
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; as the author does. If that's not the case for you (e.g. you often
|
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
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; least, you will want to turn off the keystroke thresholds and rest
|
|
|
|
|
;; interval tracking.
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
;; 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
|
2015-05-21 17:04:45 +00:00
|
|
|
|
;; or set the variable of the same name to t.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
|
|
|
|
;; 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>
|
2000-07-24 00:50:10 +00:00
|
|
|
|
;; Kleanthes Koniaris <kgk@koniaris.com>
|
1999-08-16 04:04:27 +00:00
|
|
|
|
;; Mark Ashton <mpashton@gnu.org>
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; Matt Wilding <wilding@cli.com>
|
1997-06-23 05:28:51 +00:00
|
|
|
|
;; Robert S. Boyer <boyer@cs.utexas.edu>
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
1994-07-14 12:10:27 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(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)
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Number of seconds between scheduled typing breaks."
|
2022-07-06 17:29:51 +00:00
|
|
|
|
:type 'natnum
|
1998-01-29 09:26:38 +00:00
|
|
|
|
:group 'type-break)
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-good-rest-interval (/ type-break-interval 6)
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Number of seconds of idle time considered to be an adequate typing rest.
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
When this variable is non-nil, Emacs checks the idle time between
|
1994-07-21 10:11:59 +00:00
|
|
|
|
keystrokes. If this idle time is long enough to be considered a \"good\"
|
1994-07-18 15:21:50 +00:00
|
|
|
|
rest from typing, then the next typing break is simply rescheduled for later.
|
|
|
|
|
|
1994-07-21 10:11:59 +00:00
|
|
|
|
If a break is interrupted before this much time elapses, the user will be
|
1998-01-29 09:26:38 +00:00
|
|
|
|
asked whether or not really to interrupt the break."
|
2012-09-28 08:01:08 +00:00
|
|
|
|
:set-after '(type-break-interval)
|
2022-07-06 17:29:51 +00:00
|
|
|
|
:type 'natnum
|
1998-01-29 09:26:38 +00:00
|
|
|
|
:group 'type-break)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(defcustom type-break-good-break-interval nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Number of seconds considered to be an adequate explicit typing rest.
|
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."
|
2013-05-09 01:40:20 +00:00
|
|
|
|
:type '(choice (const nil) integer)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
:group 'type-break)
|
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-keystroke-threshold
|
1994-07-21 10:11:59 +00:00
|
|
|
|
;; Assuming typing speed is 35wpm (on the average, do you really
|
1994-07-19 04:41:50 +00:00
|
|
|
|
;; 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
|
1994-07-18 07:37:18 +00:00
|
|
|
|
;; 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.
|
1994-07-19 04:41:50 +00:00
|
|
|
|
;; Conversely, the minimum threshold should be about a fifth of this.
|
1994-07-21 10:11:59 +00:00
|
|
|
|
(let* ((wpm 35)
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(avg-word-length 5)
|
|
|
|
|
(upper (* wpm avg-word-length (/ type-break-interval 60)))
|
1994-07-19 04:41:50 +00:00
|
|
|
|
(lower (/ upper 5)))
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(cons lower upper))
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Upper and lower bound on number of keystrokes for considering typing break.
|
1998-01-29 09:26:38 +00:00
|
|
|
|
This structure is a pair of numbers (MIN . MAX).
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
1994-07-18 15:21:50 +00:00
|
|
|
|
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.
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
The second number is the maximum number of keystrokes that can be entered
|
|
|
|
|
before a typing break is requested immediately, pre-empting the originally
|
1994-07-18 15:21:50 +00:00
|
|
|
|
scheduled break. If this second value is nil, then no pre-emptive breaks
|
|
|
|
|
will occur; only scheduled ones will.
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
Keys with bucky bits (shift, control, meta, etc) are counted as only one
|
1997-06-23 04:58:15 +00:00
|
|
|
|
keystroke even though they really require multiple keys to generate them.
|
|
|
|
|
|
|
|
|
|
The command `type-break-guesstimate-keystroke-threshold' can be used to
|
1998-01-29 09:26:38 +00:00
|
|
|
|
guess a reasonably good pair of values for this variable."
|
2012-09-28 08:01:08 +00:00
|
|
|
|
:set-after '(type-break-interval)
|
2016-01-30 19:48:18 +00:00
|
|
|
|
:type '(cons (choice integer (const nil)) (choice integer (const nil)))
|
1998-01-29 09:26:38 +00:00
|
|
|
|
:group 'type-break)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(defcustom type-break-query-function 'yes-or-no-p
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Function to use for making query for a typing break.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
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'.
|
|
|
|
|
|
2003-05-06 17:50:17 +00:00
|
|
|
|
To avoid being queried at all, set `type-break-query-mode' to nil."
|
2000-07-24 00:50:10 +00:00
|
|
|
|
:type '(radio function
|
|
|
|
|
(function-item yes-or-no-p)
|
|
|
|
|
(function-item y-or-n-p))
|
|
|
|
|
:group 'type-break)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-query-interval 60
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Number of seconds between queries to take a break, if put off.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
The user will continue to be prompted at this interval until he or she
|
1998-01-29 09:26:38 +00:00
|
|
|
|
finally submits to taking a typing break."
|
2022-07-06 17:29:51 +00:00
|
|
|
|
:type 'natnum
|
1998-01-29 09:26:38 +00:00
|
|
|
|
:group 'type-break)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-time-warning-intervals '(300 120 60 30)
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"List of time intervals for warnings about upcoming typing break.
|
1994-07-28 17:32:36 +00:00
|
|
|
|
At each of the intervals (specified in seconds) away from a scheduled
|
1998-01-29 09:26:38 +00:00
|
|
|
|
typing break, print a warning in the echo area."
|
|
|
|
|
:type '(repeat integer)
|
|
|
|
|
:group 'type-break)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-keystroke-warning-intervals '(300 200 100 50)
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"List of keystroke measurements for warnings about upcoming typing break.
|
1994-07-28 17:32:36 +00:00
|
|
|
|
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
|
1998-01-29 09:26:38 +00:00
|
|
|
|
will occur."
|
|
|
|
|
:type '(repeat integer)
|
|
|
|
|
:group 'type-break)
|
|
|
|
|
|
|
|
|
|
(defcustom type-break-warning-repeat 40
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Number of keystrokes for which warnings should be repeated.
|
1994-07-28 17:32:36 +00:00
|
|
|
|
That is, for each of this many keystrokes the warning is redisplayed
|
1998-01-29 09:26:38 +00:00
|
|
|
|
in the echo area to make sure it's really seen."
|
2022-07-06 17:29:51 +00:00
|
|
|
|
:type 'natnum
|
1998-01-29 09:26:38 +00:00
|
|
|
|
:group 'type-break)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(defcustom type-break-time-stamp-format "[%H:%M] "
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Timestamp format used to prefix messages.
|
2000-07-24 00:50:10 +00:00
|
|
|
|
Format specifiers are as used by `format-time-string'."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'type-break)
|
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(defcustom type-break-demo-functions
|
1994-07-28 17:32:36 +00:00
|
|
|
|
'(type-break-demo-boring type-break-demo-life type-break-demo-hanoi)
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"List of functions to consider running as demos during typing breaks.
|
1994-07-14 12:10:27 +00:00
|
|
|
|
When a typing break begins, one of these functions is selected randomly
|
2004-04-27 13:12:07 +00:00
|
|
|
|
to have Emacs do something interesting.
|
1994-02-14 00:41:56 +00:00
|
|
|
|
|
1994-07-21 10:11:59 +00:00
|
|
|
|
Any function in this list should start a demo which ceases as soon as a
|
1998-01-29 09:26:38 +00:00
|
|
|
|
key is pressed."
|
|
|
|
|
:type '(repeat function)
|
|
|
|
|
:group 'type-break)
|
1994-02-14 00:41:56 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(defcustom type-break-demo-boring-stats nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Show word per minute and keystroke figures in the Boring demo."
|
2004-04-27 13:12:07 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'type-break)
|
|
|
|
|
|
|
|
|
|
(defcustom type-break-terse-messages nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Use slightly terser messages."
|
2004-04-27 13:12:07 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'type-break)
|
|
|
|
|
|
2013-03-12 02:08:21 +00:00
|
|
|
|
(defcustom type-break-file-name
|
|
|
|
|
(locate-user-emacs-file "type-break" ".type-break")
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Name of file used to save state across sessions.
|
2005-01-15 13:06:55 +00:00
|
|
|
|
If this is nil, no data will be saved across sessions."
|
2014-01-27 02:02:28 +00:00
|
|
|
|
:version "24.4" ; added locate-user
|
2013-03-12 02:08:21 +00:00
|
|
|
|
:type 'file)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(defvar type-break-post-command-hook '(type-break-check)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
"Hook run indirectly by `post-command-hook' for typing break functions.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
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.")
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
;; 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))
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"Format of messages in the mode line concerning typing breaks.")
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
(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)
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(defvar type-break-mode-line-break-string " *** TAKE A TYPING BREAK NOW ***")
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
(defvar type-break-mode-line-warning
|
|
|
|
|
'(type-break-mode-line-break-message-p
|
|
|
|
|
("")
|
|
|
|
|
(type-break-warning-countdown-string
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(" *** "
|
|
|
|
|
"Break in "
|
1997-06-23 05:28:51 +00:00
|
|
|
|
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'
|
2003-04-11 13:07:10 +00:00
|
|
|
|
\(which indicates whether this value is a number of keystrokes or seconds)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
is installed in `mode-line-format' to notify of imminent typing breaks.")
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
(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\".")
|
|
|
|
|
|
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
;; These are internal variables. Do not set them yourself.
|
1994-02-14 00:41:56 +00:00
|
|
|
|
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(defvar type-break-alarm-p nil)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(defvar type-break-keystroke-count 0)
|
|
|
|
|
(defvar type-break-time-last-break nil)
|
|
|
|
|
(defvar type-break-time-next-break nil)
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(defvar type-break-time-last-command (time-convert nil 'integer))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(defvar type-break-interval-start nil)
|
|
|
|
|
|
1994-07-21 10:11:59 +00:00
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
;;;###autoload
|
2012-09-28 15:17:08 +00:00
|
|
|
|
(define-minor-mode type-break-mode
|
1994-07-18 07:37:18 +00:00
|
|
|
|
"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
|
2004-04-27 13:12:07 +00:00
|
|
|
|
is asked to take a break. If the user refuses at that time, Emacs will ask
|
1994-07-18 07:37:18 +00:00
|
|
|
|
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.
|
|
|
|
|
|
1994-07-18 15:21:50 +00:00
|
|
|
|
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.
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
1994-07-21 10:11:59 +00:00
|
|
|
|
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
|
2004-04-27 13:12:07 +00:00
|
|
|
|
later even if Emacs didn't prompt you to take one first. Also, if a break
|
1994-07-21 10:11:59 +00:00
|
|
|
|
is ended before this much time has elapsed, the user will be asked whether
|
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.
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
|
|
|
|
The variable `type-break-keystroke-threshold' is used to determine the
|
|
|
|
|
thresholds at which typing breaks should be considered. You can use
|
1997-06-23 04:58:15 +00:00
|
|
|
|
the command `type-break-guesstimate-keystroke-threshold' to try to
|
1994-07-18 15:21:50 +00:00
|
|
|
|
approximate good values for this.
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
1997-06-23 04:58:15 +00:00
|
|
|
|
There are several variables that affect how or when warning messages about
|
|
|
|
|
imminent typing breaks are displayed. They include:
|
|
|
|
|
|
1998-05-13 01:46:28 +00:00
|
|
|
|
`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'
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
There are several variables that affect if, how, and when queries to begin
|
|
|
|
|
a typing break occur. They include:
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
1998-05-13 01:46:28 +00:00
|
|
|
|
`type-break-query-mode'
|
|
|
|
|
`type-break-query-function'
|
|
|
|
|
`type-break-query-interval'
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
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."
|
2012-09-28 15:17:08 +00:00
|
|
|
|
:lighter type-break-mode-line-format
|
|
|
|
|
:global t
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
2012-09-28 15:17:08 +00:00
|
|
|
|
(type-break-check-post-command-hook)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
2012-09-28 15:17:08 +00:00
|
|
|
|
(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)
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(time-convert nil 'integer)))
|
2012-09-28 15:17:08 +00:00
|
|
|
|
|
|
|
|
|
;; 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))
|
2012-09-28 15:17:08 +00:00
|
|
|
|
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.
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(setq type-break-interval-start (time-convert nil 'integer))
|
2012-09-28 15:17:08 +00:00
|
|
|
|
(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)
|
2017-04-12 20:14:20 +00:00
|
|
|
|
(kill-current-buffer))))))
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
2010-05-03 02:29:46 +00:00
|
|
|
|
(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.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
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.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
Variables controlling the display of messages in the mode line include:
|
|
|
|
|
|
1998-05-13 01:46:28 +00:00
|
|
|
|
`mode-line-format'
|
|
|
|
|
`global-mode-string'
|
|
|
|
|
`type-break-mode-line-break-message'
|
|
|
|
|
`type-break-mode-line-warning'"
|
2013-05-15 23:55:41 +00:00
|
|
|
|
:global t :group 'type-break)
|
2010-05-03 02:29:46 +00:00
|
|
|
|
|
|
|
|
|
(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.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
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."
|
2013-05-15 23:55:41 +00:00
|
|
|
|
:global t :group 'type-break)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
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."
|
2005-01-15 13:06:55 +00:00
|
|
|
|
(if (and type-break-file-name
|
|
|
|
|
(not (stringp (file-locked-p type-break-file-name))))
|
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."
|
2005-01-15 13:06:55 +00:00
|
|
|
|
(if (and type-break-file-name
|
|
|
|
|
(not (stringp (file-locked-p type-break-file-name))))
|
2004-12-27 16:37:36 +00:00
|
|
|
|
;; 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))
|
2004-12-27 16:37:36 +00:00
|
|
|
|
(insert (format "%s" type-break-keystroke-count))
|
|
|
|
|
;; file saving is left to auto-save
|
|
|
|
|
))))))
|
2004-04-27 13:12:07 +00:00
|
|
|
|
|
2022-08-04 09:37:52 +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."
|
2011-07-03 23:51:42 +00:00
|
|
|
|
(condition-case nil
|
2011-07-04 01:06:33 +00:00
|
|
|
|
(and (float-time time) time)
|
2011-07-03 23:51:42 +00:00
|
|
|
|
(error nil)))
|
2004-04-27 13:12:07 +00:00
|
|
|
|
|
|
|
|
|
(defun type-break-choose-file ()
|
|
|
|
|
"Return file to read from."
|
|
|
|
|
(cond
|
2005-01-15 13:06:55 +00:00
|
|
|
|
((not type-break-file-name)
|
|
|
|
|
nil)
|
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."
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(let ((file (type-break-choose-file)))
|
|
|
|
|
(if file
|
2022-08-04 09:37:52 +00:00
|
|
|
|
(type-break-timep ;; returns expected format, else nil
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(with-current-buffer (find-file-noselect file 'nowarn)
|
2007-03-04 17:50:46 +00:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(read (current-buffer)))
|
|
|
|
|
(end-of-file
|
2021-01-21 17:10:16 +00:00
|
|
|
|
(warn "End of file in `%s'" file))))))))
|
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)
|
2007-03-11 21:17:06 +00:00
|
|
|
|
(condition-case nil
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(read (current-buffer)))
|
|
|
|
|
(end-of-file
|
2021-01-21 17:10:16 +00:00
|
|
|
|
(warn "End of file in `%s'" file)))))))
|
2004-04-27 13:12:07 +00:00
|
|
|
|
file
|
|
|
|
|
0)))
|
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
1994-02-14 00:41:56 +00:00
|
|
|
|
;;;###autoload
|
1994-07-14 12:10:27 +00:00
|
|
|
|
(defun type-break ()
|
|
|
|
|
"Take a typing break.
|
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
During the break, a demo selected from the functions listed in
|
1994-07-21 10:11:59 +00:00
|
|
|
|
`type-break-demo-functions' is run.
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
After the typing break is finished, the next break is scheduled
|
1994-07-21 10:11:59 +00:00
|
|
|
|
as per the function `type-break-schedule'."
|
1994-02-14 00:41:56 +00:00
|
|
|
|
(interactive)
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(do-auto-save)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-cancel-schedule)
|
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)
|
1994-07-21 10:11:59 +00:00
|
|
|
|
(let ((continue t)
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(start-time (time-convert nil 'integer)))
|
1994-07-21 10:11:59 +00:00
|
|
|
|
(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))
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(unless type-break-terse-messages
|
|
|
|
|
(message "Press any key to resume from typing break."))
|
1994-07-21 10:11:59 +00:00
|
|
|
|
|
|
|
|
|
(let* ((len (length type-break-demo-functions))
|
|
|
|
|
(idx (random len))
|
|
|
|
|
(fn (nth idx type-break-demo-functions)))
|
|
|
|
|
(condition-case ()
|
|
|
|
|
(funcall fn)
|
|
|
|
|
(error nil))))
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
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)))
|
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))))))
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-keystroke-reset)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(type-break-file-time)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-mode-line-countdown-or-break nil)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(type-break-schedule))
|
1994-02-14 00:41:56 +00:00
|
|
|
|
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(defun type-break-schedule (&optional time start interval)
|
1994-08-09 21:21:28 +00:00
|
|
|
|
"Schedule a typing break for TIME seconds from now.
|
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)."
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(interactive (list (and current-prefix-arg
|
|
|
|
|
(prefix-numeric-value current-prefix-arg))))
|
1994-07-14 12:10:27 +00:00
|
|
|
|
(or time (setq time type-break-interval))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-check-post-command-hook)
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(type-break-cancel-schedule)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-time-warning-schedule time 'reset)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-run-at-time (max 1 time) nil 'type-break-alarm)
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(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
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(defun type-break-cancel-schedule ()
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-cancel-time-warning-schedule)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-cancel-function-timers 'type-break-alarm)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(setq type-break-alarm-p nil)
|
|
|
|
|
(setq type-break-time-next-break nil))
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(defun type-break-time-warning-schedule (&optional time resetp)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(let ((type-break-current-time-warning-interval nil))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-cancel-time-warning-schedule))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(add-hook 'type-break-post-command-hook 'type-break-time-warning 'append)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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
|
1994-07-28 17:32:36 +00:00
|
|
|
|
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))
|
|
|
|
|
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;(let (type-break-current-time-warning-interval)
|
|
|
|
|
; (type-break-cancel-time-warning-schedule))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-run-at-time (max 1 time) nil 'type-break-time-warning-alarm)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
|
|
|
|
(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"))))))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
(defun type-break-cancel-time-warning-schedule ()
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-cancel-function-timers 'type-break-time-warning-alarm)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(remove-hook 'type-break-post-command-hook 'type-break-time-warning)
|
|
|
|
|
(setq type-break-current-time-warning-interval
|
1997-06-23 04:58:15 +00:00
|
|
|
|
type-break-time-warning-intervals)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(setq type-break-time-warning-count 0) ; avoid warnings after break
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(setq type-break-warning-countdown-string nil))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(defun type-break-alarm ()
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-check-post-command-hook)
|
|
|
|
|
(setq type-break-alarm-p t)
|
|
|
|
|
(type-break-mode-line-countdown-or-break 'break))
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(defun type-break-time-warning-alarm ()
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-check-post-command-hook)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-time-warning-schedule)
|
|
|
|
|
(setq type-break-time-warning-count type-break-warning-repeat)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-time-warning)
|
|
|
|
|
(type-break-mode-line-countdown-or-break 'countdown))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun type-break-run-tb-post-command-hook ()
|
|
|
|
|
(and type-break-mode
|
|
|
|
|
(run-hooks 'type-break-post-command-hook)))
|
|
|
|
|
|
1994-07-14 12:10:27 +00:00
|
|
|
|
(defun type-break-check ()
|
1994-07-18 07:37:18 +00:00
|
|
|
|
"Ask to take a typing break if appropriate.
|
|
|
|
|
This may be the case either because the scheduled time has come \(and the
|
2015-09-17 23:08:20 +00:00
|
|
|
|
minimum keystroke threshold has been reached) or because the maximum
|
1994-07-18 07:37:18 +00:00
|
|
|
|
keystroke threshold has been exceeded."
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(type-break-file-keystroke-count)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
type-break-good-rest-interval)
|
|
|
|
|
(progn
|
|
|
|
|
(type-break-keystroke-reset)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-mode-line-countdown-or-break nil)
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(setq type-break-time-last-break (time-convert nil 'integer))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-schedule)))
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(setq type-break-time-last-command (time-convert nil 'integer))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
(and type-break-keystroke-threshold
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(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)))))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
(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
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; max-threshold, lower it to reduce the likelihood of an
|
1994-07-28 17:32:36 +00:00
|
|
|
|
;; 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.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(defun type-break-check-keystroke-warning ()
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; This is safe because the caller should have checked that the cdr was
|
|
|
|
|
;; non-nil already.
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(setq type-break-warning-countdown-string (number-to-string left))
|
|
|
|
|
(setq type-break-warning-countdown-string-type "keystrokes")
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(type-break-mode-line-countdown-or-break 'countdown)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
t))))
|
1994-07-18 07:37:18 +00:00
|
|
|
|
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; Arrange for a break query to be made, when the user stops typing furiously.
|
1994-07-18 07:37:18 +00:00
|
|
|
|
(defun type-break-query ()
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(add-hook 'type-break-post-command-hook 'type-break-do-query))
|
|
|
|
|
|
|
|
|
|
(defun type-break-do-query ()
|
|
|
|
|
(cond
|
1997-06-23 05:28:51 +00:00
|
|
|
|
((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)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(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))
|
2000-07-24 00:50:10 +00:00
|
|
|
|
;; 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)
|
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)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(funcall type-break-query-function
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(format "%s%s"
|
|
|
|
|
(type-break-time-stamp)
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(if type-break-terse-messages
|
|
|
|
|
"Break now? "
|
|
|
|
|
"Take a break from typing now? "))))
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(type-break))
|
|
|
|
|
(t
|
|
|
|
|
(type-break-schedule type-break-query-interval)))
|
|
|
|
|
(quit
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(type-break-schedule type-break-query-interval))))))
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun type-break-noninteractive-query (&optional _ignored-args)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
"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'."
|
2015-08-21 21:08:47 +00:00
|
|
|
|
(type-break-time-stamp)
|
|
|
|
|
(substitute-command-keys "\\[type-break]"))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(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)))
|
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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
|
1997-06-23 04:58:15 +00:00
|
|
|
|
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.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
;; Otherwise, it is particularly annoying for the sit-for below to
|
|
|
|
|
;; delay redisplay when one types sequences like `C-u -1 C-l'.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
((memq this-command '(digit-argument universal-argument)))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
((not type-break-mode-line-message-mode)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
;; Pause for a moment so any previous message can be seen.
|
|
|
|
|
(sit-for 2)
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(message "%sWarning: typing break due in %s."
|
|
|
|
|
(type-break-time-stamp)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(type-break-format-time timeleft))
|
|
|
|
|
(setq type-break-time-warning-count
|
|
|
|
|
(1- type-break-time-warning-count))))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(t
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(remove-hook 'type-break-post-command-hook 'type-break-time-warning)
|
|
|
|
|
(setq type-break-warning-countdown-string nil))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
(defun type-break-keystroke-warning ()
|
|
|
|
|
(cond
|
|
|
|
|
((> type-break-keystroke-warning-count 0)
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(setq type-break-warning-countdown-string
|
|
|
|
|
(number-to-string (- (cdr type-break-keystroke-threshold)
|
|
|
|
|
type-break-keystroke-count)))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq (selected-window) (minibuffer-window)))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
;; 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)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(sit-for 2)
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(message "%sWarning: typing break due in %s keystrokes."
|
|
|
|
|
(type-break-time-stamp)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(- (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
|
1997-06-23 04:58:15 +00:00
|
|
|
|
'type-break-keystroke-warning)
|
|
|
|
|
(setq type-break-warning-countdown-string nil))))
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(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))
|
|
|
|
|
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
|
|
|
|
;;;###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
|
1997-06-23 04:58:15 +00:00
|
|
|
|
Typing break mode is currently %s.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
Interactive query for breaks is %s.
|
|
|
|
|
Warnings of imminent typing breaks in mode line is %s.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
|
|
|
|
Last typing break ended : %s
|
1994-07-18 15:21:50 +00:00
|
|
|
|
Next scheduled typing break : %s\n
|
|
|
|
|
Minimum keystroke threshold : %s
|
|
|
|
|
Maximum keystroke threshold : %s
|
|
|
|
|
Current keystroke count : %s"
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(if type-break-mode "enabled" "disabled")
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(if type-break-query-mode "enabled" "disabled")
|
|
|
|
|
(if type-break-mode-line-message-mode "enabled" "disabled")
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(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)
|
1994-07-19 00:52:56 +00:00
|
|
|
|
(format "%s\t(%s from now)"
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(current-time-string type-break-time-next-break)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(type-break-format-time
|
1994-07-21 10:11:59 +00:00
|
|
|
|
(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)))
|
1994-07-18 15:21:50 +00:00
|
|
|
|
"none scheduled")
|
|
|
|
|
(or (car type-break-keystroke-threshold) "none")
|
|
|
|
|
(or (cdr type-break-keystroke-threshold) "none")
|
|
|
|
|
type-break-keystroke-count))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(defun type-break-guesstimate-keystroke-threshold (wpm &optional wordlen frac)
|
1994-07-18 15:21:50 +00:00
|
|
|
|
"Guess values for the minimum/maximum keystroke threshold for typing breaks.
|
1997-06-23 04:58:15 +00:00
|
|
|
|
|
1994-07-18 15:21:50 +00:00
|
|
|
|
If called interactively, the user is prompted for their guess as to how
|
1997-06-23 04:58:15 +00:00
|
|
|
|
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
|
1997-06-23 05:28:51 +00:00
|
|
|
|
tends to type less when debugging a program as opposed to writing
|
1997-06-23 04:58:15 +00:00
|
|
|
|
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.
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
When called from Lisp programs, the optional args WORDLEN and FRAC can be
|
1994-07-18 15:21:50 +00:00
|
|
|
|
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."
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(interactive "NOn average, how many words per minute do you type? ")
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(let* ((upper (* wpm (or wordlen 5) (/ type-break-interval 60)))
|
1994-07-19 04:41:50 +00:00
|
|
|
|
(lower (/ upper (or frac 5))))
|
1994-07-18 15:21:50 +00:00
|
|
|
|
(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)
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2004-10-27 15:04:26 +00:00
|
|
|
|
(message "min threshold: %d\tmax threshold: %d" lower upper))
|
|
|
|
|
type-break-keystroke-threshold))
|
1994-07-18 15:21:50 +00:00
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
;;; misc functions
|
|
|
|
|
|
2022-08-01 07:38:33 +00:00
|
|
|
|
;; Compute the difference, in seconds, between a and b, two time values.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(defun type-break-time-difference (a b)
|
2011-07-03 23:51:42 +00:00
|
|
|
|
(round (float-time (time-subtract b a))))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
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.
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(defun type-break-time-sum (&rest tmlist)
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(let ((sum 0))
|
2012-09-28 15:17:08 +00:00
|
|
|
|
(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)))
|
2012-09-28 15:17:08 +00:00
|
|
|
|
sum))
|
1994-08-09 21:21:28 +00:00
|
|
|
|
|
2000-07-24 00:50:10 +00:00
|
|
|
|
(defun type-break-time-stamp (&optional when)
|
2020-10-16 13:26:37 +00:00
|
|
|
|
(format-time-string type-break-time-stamp-format when))
|
2000-07-24 00:50:10 +00:00
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(defun type-break-format-time (secs)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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 ()
|
2022-08-01 07:38:33 +00:00
|
|
|
|
(setq type-break-interval-start (time-convert nil 'integer))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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))
|
|
|
|
|
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(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)))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(set-buffer-modified-p (buffer-modified-p)))
|
|
|
|
|
|
2004-04-27 13:12:07 +00:00
|
|
|
|
;; If an exception occurs in Emacs while running the post command hook, the
|
1997-06-23 05:28:51 +00:00
|
|
|
|
;; 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))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Timer wrapper functions
|
* 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
|
|
|
|
;;
|
|
|
|
|
;; These shield type-break from variations in the interval timer packages
|
|
|
|
|
;; for different versions of Emacs.
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
|
|
|
|
(defun type-break-run-at-time (time repeat function)
|
2004-03-09 15:28:27 +00:00
|
|
|
|
(condition-case nil (or (require 'timer) (require 'itimer)) (error nil))
|
2004-10-27 15:04:26 +00:00
|
|
|
|
(run-at-time time repeat function))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
2004-03-09 15:28:27 +00:00
|
|
|
|
(defvar timer-dont-exit)
|
1997-06-23 05:28:51 +00:00
|
|
|
|
(defun type-break-cancel-function-timers (function)
|
2004-10-27 15:04:26 +00:00
|
|
|
|
(let ((timer-dont-exit t))
|
|
|
|
|
(cancel-function-timers function)))
|
1997-06-23 05:28:51 +00:00
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
|
|
|
|
|
;;; Demo wrappers
|
|
|
|
|
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(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)))
|
|
|
|
|
|
1994-07-28 17:32:36 +00:00
|
|
|
|
;; 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.
|
2007-01-20 02:48:45 +00:00
|
|
|
|
(read-event)
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(type-break-catch-up-event)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(kill-buffer "*Hanoi*"))
|
|
|
|
|
(quit
|
2007-01-20 02:48:45 +00:00
|
|
|
|
(read-event)
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(type-break-catch-up-event)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(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
|
2007-01-20 02:48:45 +00:00
|
|
|
|
(read-event)
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(type-break-catch-up-event)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(kill-buffer "*Life*"))
|
|
|
|
|
(life-extinct
|
1997-06-23 04:58:15 +00:00
|
|
|
|
(message "%s" (get 'life-extinct 'error-message))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
;; restart demo
|
|
|
|
|
(setq continue t))
|
|
|
|
|
(quit
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(type-break-catch-up-event)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(and (get-buffer "*Life*")
|
|
|
|
|
(kill-buffer "*Life*")))))))
|
|
|
|
|
|
1994-08-09 21:21:28 +00:00
|
|
|
|
;; Boring demo, but doesn't use many cycles
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(defun type-break-demo-boring ()
|
|
|
|
|
"Boring typing break demo."
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(let ((rmsg (if type-break-terse-messages
|
|
|
|
|
""
|
|
|
|
|
"Press any key to resume from typing break"))
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(buffer-name "*Typing Break Buffer*")
|
2004-04-27 13:12:07 +00:00
|
|
|
|
lines elapsed timeleft tmsg)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(condition-case ()
|
|
|
|
|
(progn
|
|
|
|
|
(switch-to-buffer (get-buffer-create buffer-name))
|
|
|
|
|
(buffer-disable-undo (current-buffer))
|
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))
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(while (not (input-pending-p))
|
2004-04-27 13:12:07 +00:00
|
|
|
|
(erase-buffer)
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(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))
|
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))))
|
1994-08-09 21:21:28 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(sit-for 60))
|
2007-01-30 19:36:41 +00:00
|
|
|
|
(read-event)
|
|
|
|
|
(type-break-catch-up-event)
|
1994-07-28 17:32:36 +00:00
|
|
|
|
(kill-buffer buffer-name))
|
|
|
|
|
(quit
|
|
|
|
|
(and (get-buffer buffer-name)
|
|
|
|
|
(kill-buffer buffer-name))))))
|
|
|
|
|
|
2022-08-04 09:37:52 +00:00
|
|
|
|
(define-obsolete-function-alias 'timep 'type-break-timep "29.1")
|
|
|
|
|
|
1994-07-14 12:10:27 +00:00
|
|
|
|
|
|
|
|
|
(provide 'type-break)
|
|
|
|
|
|
1998-01-29 09:26:38 +00:00
|
|
|
|
(if type-break-mode
|
|
|
|
|
(type-break-mode 1))
|
2000-07-24 00:50:10 +00:00
|
|
|
|
|
1994-07-14 12:10:27 +00:00
|
|
|
|
;;; type-break.el ends here
|