aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-07-23 15:40:25 +0000
committerRichard M. Stallman1996-07-23 15:40:25 +0000
commit0c1241267e595c397a812bc0afa93d7209768f94 (patch)
tree49e60ba8673de3b7008b5f6f9653b636447d30e6
parent5e8ae792b15ee318e5493803e3c8c5980e53aa70 (diff)
downloademacs-0c1241267e595c397a812bc0afa93d7209768f94.tar.gz
emacs-0c1241267e595c397a812bc0afa93d7209768f94.zip
Lots of timer feature updates.
encode-time takes additional arguments and ignores them. Change linux to gnu/linux for system-type. More information about key translation features.
-rw-r--r--lispref/os.texi133
1 files changed, 112 insertions, 21 deletions
diff --git a/lispref/os.texi b/lispref/os.texi
index f941b3bfb05..e231a0937ad 100644
--- a/lispref/os.texi
+++ b/lispref/os.texi
@@ -566,7 +566,10 @@ Berkeley BSD.
566Data General DGUX operating system. 566Data General DGUX operating system.
567 567
568@item gnu 568@item gnu
569A GNU system using the GNU HURD and Mach. 569A GNU system (using the GNU kernel, which consists of the HURD and Mach).
570
571@item gnu/linux
572A variant GNU system using the Linux kernel.
570 573
571@item hpux 574@item hpux
572Hewlett-Packard HPUX operating system. 575Hewlett-Packard HPUX operating system.
@@ -574,9 +577,6 @@ Hewlett-Packard HPUX operating system.
574@item irix 577@item irix
575Silicon Graphics Irix system. 578Silicon Graphics Irix system.
576 579
577@item linux
578A GNU system using the Linux kernel.
579
580@item ms-dos 580@item ms-dos
581Microsoft MS-DOS ``operating system.'' 581Microsoft MS-DOS ``operating system.''
582 582
@@ -1023,7 +1023,7 @@ Note that Common Lisp has different meanings for @var{dow} and
1023@var{zone}. 1023@var{zone}.
1024@end defun 1024@end defun
1025 1025
1026@defun encode-time seconds minutes hour day month year &optional zone 1026@defun encode-time seconds minutes hour day month year &optional @dots{}zone
1027This function is the inverse of @code{decode-time}. It converts seven 1027This function is the inverse of @code{decode-time}. It converts seven
1028items of calendrical data into a time value. For the meanings of the 1028items of calendrical data into a time value. For the meanings of the
1029arguments, see the table above under @code{decode-time}. 1029arguments, see the table above under @code{decode-time}.
@@ -1037,12 +1037,31 @@ its daylight savings time rules. If specified, it can be either a list
1037(as you would get from @code{current-time-zone}) or an integer (as you 1037(as you would get from @code{current-time-zone}) or an integer (as you
1038would get from @code{decode-time}). The specified zone is used without 1038would get from @code{decode-time}). The specified zone is used without
1039any further alteration for daylight savings time. 1039any further alteration for daylight savings time.
1040
1041If you pass more than seven arguments to @code{encode-time}, the first
1042six are used as @var{seconds} through @var{year}, the last argument is
1043used as @var{zone}, and the arguments in between are ignored. This
1044feature makes it possible to use the elements of a list returned by
1045@code{decode-time} as the arguments to @code{encode-time}, like this:
1046
1047@example
1048(apply 'encode-time (decode-time @dots{}))
1049@end example
1040@end defun 1050@end defun
1041 1051
1042@node Timers 1052@node Timers
1043@section Timers for Delayed Execution 1053@section Timers for Delayed Execution
1054@cindex timer
1044 1055
1045You can set up a timer to call a function at a specified future time. 1056 You can set up a @dfn{timer} to call a function at a specified future time or
1057after a certain length of idleness.
1058
1059 Emacs cannot run a timer at any arbitrary point in a Lisp program; it
1060can run them only when Emacs could accept output from a subprocess:
1061namely, while waiting or inside certain primitive functions such as
1062@code{sit-for} or @code{read-char} which @emph{can} wait. Therefore, a
1063timer's execution may be delayed if Emacs is busy. However, the time of
1064execution is very precise if Emacs is idle.
1046 1065
1047@defun run-at-time time repeat function &rest args 1066@defun run-at-time time repeat function &rest args
1048This function arranges to call @var{function} with arguments @var{args} 1067This function arranges to call @var{function} with arguments @var{args}
@@ -1050,7 +1069,7 @@ at time @var{time}. The argument @var{function} is a function to call
1050later, and @var{args} are the arguments to give it when it is called. 1069later, and @var{args} are the arguments to give it when it is called.
1051The time @var{time} is specified as a string. 1070The time @var{time} is specified as a string.
1052 1071
1053Absolute times may be specified in a wide variety of formats; The form 1072Absolute times may be specified in a variety of formats; The form
1054@samp{@var{hour}:@var{min}:@var{sec} @var{timezone} 1073@samp{@var{hour}:@var{min}:@var{sec} @var{timezone}
1055@var{month}/@var{day}/@var{year}}, where all fields are numbers, works; 1074@var{month}/@var{day}/@var{year}}, where all fields are numbers, works;
1056the format that @code{current-time-string} returns is also allowed. 1075the format that @code{current-time-string} returns is also allowed.
@@ -1067,26 +1086,85 @@ denotes 65 seconds from now.
1067denotes exactly 103 months, 123 days, and 10862 seconds from now. 1086denotes exactly 103 months, 123 days, and 10862 seconds from now.
1068@end table 1087@end table
1069 1088
1070If @var{time} is an integer, that specifies a relative time measured in 1089If @var{time} is a number (integer or floating point), that specifies a
1071seconds. 1090relative time measured in seconds.
1072 1091
1073The argument @var{repeat} specifies how often to repeat the call. If 1092The argument @var{repeat} specifies how often to repeat the call. If
1074@var{repeat} is @code{nil}, there are no repetitions; @var{function} is 1093@var{repeat} is @code{nil}, there are no repetitions; @var{function} is
1075called just once, at @var{time}. If @var{repeat} is an integer, it 1094called just once, at @var{time}. If @var{repeat} is a number, it
1076specifies a repetition period measured in seconds. In any case, @var{repeat} 1095specifies a repetition period measured in seconds. In any case,
1077has no effect on when @emph{first} call takes place---@var{time} specifies 1096@var{repeat} has no effect on when @emph{first} call takes
1078that. 1097place---@var{time} alone specifies that.
1079 1098
1080The function @code{run-at-time} returns a timer value that identifies 1099The function @code{run-at-time} returns a timer value that identifies
1081the particular scheduled future action. You can use this value to call 1100the particular scheduled future action. You can use this value to call
1082@code{cancel-timer}. 1101@code{cancel-timer} (see below).
1102@end defun
1103
1104@defmac with-timeout (seconds timeout-forms@dots{}) body@dots{}
1105Execute @var{body}, but give up after @var{seconds} seconds. If
1106@var{body} finishes before the time is up, @code{with-timeout} returns
1107the value of the last form in @var{body}. If, however, the execution of
1108@var{body} is cut short by the timeout, then @code{with-timeout}
1109executes all the @var{timeout-forms} and returns the value of the last
1110of them.
1111
1112This macro works by set a timer to run after @var{seconds} seconds. If
1113@var{body} finishes before that time, it cancels the timer. If the
1114timer actually runs, it terminates execution of @var{body}, then
1115executes @var{timeout-forms}.
1116
1117Since timers can run within a Lisp program only when the program calls a
1118primitive that can wait, @code{with-timeout} cannot stop executing
1119@var{body} while it is in the midst of a computation---only when it
1120calls one of those primitives. So use @code{with-timeout} only with a
1121@var{body} that waits for input, not one that does a long computation.
1122@end defmac
1123
1124 The function @code{y-or-n-p-with-timeout} provides a simple way to use
1125a timer to avoid waiting too long for an answer. @xref{Yes-or-No
1126Queries}.
1127
1128@defun run-with-idle-timer secs repeat function &rest args
1129Set up a timer which runs when Emacs has been idle for @var{secs}
1130seconds. The value of @var{secs} may be an integer or a floating point
1131number.
1132
1133If @var{repeat} is @code{nil}, the timer runs just once, the first time
1134Emacs remains idle for a long enough time. More often @var{repeat} is
1135non-@code{nil}, which means to run the timer @emph{each time} Emacs
1136remains idle for @var{secs} seconds.
1137
1138The function @code{run-with-idle-timer} returns a timer value which you
1139can use in calling @code{cancel-timer} (see below).
1083@end defun 1140@end defun
1084 1141
1142@cindex idleness
1143 Emacs becomes ``idle'' when it starts waiting for user input, and it
1144remains idle until the user provides some input. If a timer is set for
1145five seconds of idleness, it runs approximately five seconds after Emacs
1146first became idle. Even if its @var{repeat} is true, this timer will
1147not run again as long as Emacs remains idle, because the duration of
1148idleness will continue to increase and will not go down to five seconds
1149again.
1150
1151 Emacs can do various things while idle: garbage collect, autosave or
1152handle data from a subprocess. But these interludes during idleness
1153have little effect on idle timers. An idle timer set for 600 seconds
1154will run when ten minutes have elapsed since the last user command was
1155finished, even if subprocess output has been accepted thousands of times
1156within those ten minutes, even if there have been garbage collections
1157and autosaves.
1158
1159 When the user supplies input, Emacs becomes non-idle while executing the
1160input. Then it becomes idle again, and all the idle timers that are
1161set up to repeat will subsequently run another time, one by one.
1162
1085@defun cancel-timer timer 1163@defun cancel-timer timer
1086Cancel the requested action for @var{timer}, which should be a value 1164Cancel the requested action for @var{timer}, which should be a value
1087previously returned by @code{run-at-time}. This cancels the effect of 1165previously returned by @code{run-at-time} or @code{run-with-idle-timer}.
1088that call to @code{run-at-time}; the arrival of the specified time will 1166This cancels the effect of that call to @code{run-at-time}; the arrival
1089not cause anything special to happen. 1167of the specified time will not cause anything special to happen.
1090@end defun 1168@end defun
1091 1169
1092@node Terminal Input 1170@node Terminal Input
@@ -1169,8 +1247,14 @@ is the character Emacs currently uses for quitting, usually @kbd{C-g}.
1169@subsection Translating Input Events 1247@subsection Translating Input Events
1170@cindex translating input events 1248@cindex translating input events
1171 1249
1172 This section describes features for translating input events into other 1250 This section describes features for translating input events into
1173input events before they become part of key sequences. 1251other input events before they become part of key sequences. These
1252features apply to each event in the order they are described here: each
1253event is first modified according to @code{extra-keyboard-modifiers},
1254then translated through @code{keyboard-translate-table} (if applicable).
1255If it is being read as part of a key sequence, it is then added to the
1256sequece being read; then subsequences containing it are checked first
1257with @code{function-key-map} and then with @code{key-translation-map}.
1174 1258
1175@c Emacs 19 feature 1259@c Emacs 19 feature
1176@defvar extra-keyboard-modifiers 1260@defvar extra-keyboard-modifiers
@@ -1250,11 +1334,15 @@ character code @var{from} into character code @var{to}. It creates
1250or enlarges the translate table if necessary. 1334or enlarges the translate table if necessary.
1251@end defun 1335@end defun
1252 1336
1337 The remaining translation features translate subsequences of key
1338sequences being read. They are implemented in @code{read-key-sequence}
1339and have no effect on @code{read-char}.
1340
1253@defvar function-key-map 1341@defvar function-key-map
1254This variable holds a keymap that describes the character sequences 1342This variable holds a keymap that describes the character sequences
1255sent by function keys on an ordinary character terminal. This keymap 1343sent by function keys on an ordinary character terminal. This keymap
1256uses the same data structure as other keymaps, but is used differently: it 1344uses the same data structure as other keymaps, but is used differently: it
1257specifies translations to make while reading events. 1345specifies translations to make while reading event sequences.
1258 1346
1259If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector 1347If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector
1260@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a 1348@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
@@ -1299,7 +1387,10 @@ finished; it receives the results of translation by
1299@code{function-key-map}. 1387@code{function-key-map}.
1300 1388
1301@item 1389@item
1302@code{key-translation-map} overrides actual key bindings. 1390@code{key-translation-map} overrides actual key bindings. For example,
1391if @kbd{C-x f} has a binding in @code{key-translation-map}, that
1392translation takes effect even though @kbd{C-x f} also has a key binding
1393in the global map.
1303@end itemize 1394@end itemize
1304 1395
1305The intent of @code{key-translation-map} is for users to map one 1396The intent of @code{key-translation-map} is for users to map one