comparison lispref/os.texi @ 79198:d2c45585a2f5

(Idle Timers): current-idle-time returns nil if not idle.
author Richard M. Stallman <rms@gnu.org>
date Wed, 24 Oct 2007 08:18:34 +0000
parents 44bc179f404b
children a1e16e813aed
comparison
equal deleted inserted replaced
79197:05ea1c83f761 79198:d2c45585a2f5
1554 input. Then it becomes idle again, and all the idle timers that are 1554 input. Then it becomes idle again, and all the idle timers that are
1555 set up to repeat will subsequently run another time, one by one. 1555 set up to repeat will subsequently run another time, one by one.
1556 1556
1557 @c Emacs 19 feature 1557 @c Emacs 19 feature
1558 @defun current-idle-time 1558 @defun current-idle-time
1559 This function returns the length of time Emacs has been idle, as a 1559 If Emacs is idle, this function returns the length of time Emacs has
1560 list of three integers: @code{(@var{high} @var{low} @var{microsec})}. 1560 been idle, as a list of three integers: @code{(@var{high} @var{low}
1561 The integers @var{high} and @var{low} combine to give the number of 1561 @var{microsec})}. The integers @var{high} and @var{low} combine to
1562 seconds of idleness, which is 1562 give the number of seconds of idleness, which is
1563 @ifnottex 1563 @ifnottex
1564 @var{high} * 2**16 + @var{low}. 1564 @var{high} * 2**16 + @var{low}.
1565 @end ifnottex 1565 @end ifnottex
1566 @tex 1566 @tex
1567 $high*2^{16}+low$. 1567 $high*2^{16}+low$.
1568 @end tex 1568 @end tex
1569 1569
1570 The third element, @var{microsec}, gives the microseconds since the 1570 The third element, @var{microsec}, gives the microseconds since the
1571 start of the current second (or 0 for systems that return time with 1571 start of the current second (or 0 for systems that return time with
1572 the resolution of only one second). 1572 the resolution of only one second).
1573
1574 When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
1575 This is a convenient way to test whether Emacs is idle.
1573 1576
1574 The main use of this function is when an idle timer function wants to 1577 The main use of this function is when an idle timer function wants to
1575 ``take a break'' for a while. It can set up another idle timer to 1578 ``take a break'' for a while. It can set up another idle timer to
1576 call the same function again, after a few seconds more idleness. 1579 call the same function again, after a few seconds more idleness.
1577 Here's an example: 1580 Here's an example: