summaryrefslogtreecommitdiff
path: root/devdocs/elisp/waiting.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/waiting.html')
-rw-r--r--devdocs/elisp/waiting.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/devdocs/elisp/waiting.html b/devdocs/elisp/waiting.html
new file mode 100644
index 00000000..c643b28c
--- /dev/null
+++ b/devdocs/elisp/waiting.html
@@ -0,0 +1,14 @@
+ <h3 class="section">Waiting for Elapsed Time or Input</h3> <p>The wait functions are designed to wait for a certain amount of time to pass or until there is input. For example, you may wish to pause in the middle of a computation to allow the user time to view the display. <code>sit-for</code> pauses and updates the screen, and returns immediately if input comes in, while <code>sleep-for</code> pauses without updating the screen. </p> <dl> <dt id="sit-for">Function: <strong>sit-for</strong> <em>seconds &amp;optional nodisp</em>
+</dt> <dd>
+<p>This function performs redisplay (provided there is no pending input from the user), then waits <var>seconds</var> seconds, or until input is available. The usual purpose of <code>sit-for</code> is to give the user time to read text that you display. The value is <code>t</code> if <code>sit-for</code> waited the full time with no input arriving (see <a href="event-input-misc">Event Input Misc</a>). Otherwise, the value is <code>nil</code>. </p> <p>The argument <var>seconds</var> need not be an integer. If it is floating point, <code>sit-for</code> waits for a fractional number of seconds. Some systems support only a whole number of seconds; on these systems, <var>seconds</var> is rounded down. </p> <p>The expression <code>(sit-for 0)</code> is equivalent to <code>(redisplay)</code>, i.e., it requests a redisplay, without any delay, if there is no pending input. See <a href="forcing-redisplay">Forcing Redisplay</a>. </p> <p>If <var>nodisp</var> is non-<code>nil</code>, then <code>sit-for</code> does not redisplay, but it still returns as soon as input is available (or when the timeout elapses). </p> <p>In batch mode (see <a href="batch-mode">Batch Mode</a>), <code>sit-for</code> cannot be interrupted, even by input from the standard input descriptor. It is thus equivalent to <code>sleep-for</code>, which is described below. </p> <p>It is also possible to call <code>sit-for</code> with three arguments, as <code>(sit-for <var>seconds</var> <var>millisec</var> <var>nodisp</var>)</code>, but that is considered obsolete. </p>
+</dd>
+</dl> <dl> <dt id="sleep-for">Function: <strong>sleep-for</strong> <em>seconds &amp;optional millisec</em>
+</dt> <dd>
+<p>This function simply pauses for <var>seconds</var> seconds without updating the display. It pays no attention to available input. It returns <code>nil</code>. </p> <p>The argument <var>seconds</var> need not be an integer. If it is floating point, <code>sleep-for</code> waits for a fractional number of seconds. Some systems support only a whole number of seconds; on these systems, <var>seconds</var> is rounded down. </p> <p>The optional argument <var>millisec</var> specifies an additional waiting period measured in milliseconds. This adds to the period specified by <var>seconds</var>. If the system doesn’t support waiting fractions of a second, you get an error if you specify nonzero <var>millisec</var>. </p> <p>Use <code>sleep-for</code> when you wish to guarantee a delay. </p>
+</dd>
+</dl> <p>See <a href="time-of-day">Time of Day</a>, for functions to get the current time. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Waiting.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Waiting.html</a>
+ </p>
+</div>