Mercurial > emacs
comparison lispref/os.texi @ 22138:d4ac295a98b3
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 19 May 1998 03:45:57 +0000 |
parents | 90da2489c498 |
children | 40089afa2b1d |
comparison
equal
deleted
inserted
replaced
22137:2b0e6a1e7fb9 | 22138:d4ac295a98b3 |
---|---|
53 The order of operations performed (in @file{startup.el}) by Emacs when | 53 The order of operations performed (in @file{startup.el}) by Emacs when |
54 it is started up is as follows: | 54 it is started up is as follows: |
55 | 55 |
56 @enumerate | 56 @enumerate |
57 @item | 57 @item |
58 It adds subdirectories to @code{load-path}, by running the file | |
59 named @file{subdirs.el} in each directory that is listed. | |
60 | |
61 @item | |
62 It sets the language environment and the terminal coding system, | |
63 if requested by environment variables such as @code{LANG}. | |
64 | |
65 @item | |
58 It loads the initialization library for the window system, if you are | 66 It loads the initialization library for the window system, if you are |
59 using a window system. This library's name is | 67 using a window system. This library's name is |
60 @file{term/@var{windowsystem}-win.el}. | 68 @file{term/@var{windowsystem}-win.el}. |
61 | 69 |
62 @item | 70 @item |
74 @samp{-no-site-file} was specified. The library's file name is usually | 82 @samp{-no-site-file} was specified. The library's file name is usually |
75 @file{site-start.el}. | 83 @file{site-start.el}. |
76 @cindex @file{site-start.el} | 84 @cindex @file{site-start.el} |
77 | 85 |
78 @item | 86 @item |
79 It loads the file @file{~/.emacs}, unless @samp{-q} was specified on the | 87 It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was |
80 command line. (This is not done in @samp{-batch} mode.) The @samp{-u} | 88 specified on the command line. The @samp{-u} option can specify another |
81 option can specify another user name whose home directory should be used | 89 user name whose home directory should be used instead of @file{~}. |
82 instead of @file{~}. | |
83 | 90 |
84 @item | 91 @item |
85 It loads the library @file{default}, unless @code{inhibit-default-init} | 92 It loads the library @file{default}, unless @code{inhibit-default-init} |
86 is non-@code{nil}. (This is not done in @samp{-batch} mode or if | 93 is non-@code{nil}. (This is not done in @samp{-batch} mode or if |
87 @samp{-q} was specified on the command line.) The library's file name | 94 @samp{-q} was specified on the command line.) The library's file name |
144 @example | 151 @example |
145 (setq inhibit-startup-echo-area-message | 152 (setq inhibit-startup-echo-area-message |
146 "@var{your-login-name}") | 153 "@var{your-login-name}") |
147 @end example | 154 @end example |
148 | 155 |
149 Simply setting @code{inhibit-startup-echo-area-message} to your login | 156 Emacs explicitly checks for an expression as shown above in your |
150 name is not sufficient to inhibit the message; Emacs explicitly checks | 157 @file{.emacs} file; your login name must appear in the expression as a |
151 whether @file{.emacs} contains an expression as shown above. Your login | 158 Lisp string constant. Other methods of setting |
152 name must appear in the expression as a Lisp string constant. | 159 @code{inhibit-startup-echo-area-message} to the same value do not |
160 inhibit the startup message. | |
153 | 161 |
154 This way, you can easily inhibit the message for yourself if you wish, | 162 This way, you can easily inhibit the message for yourself if you wish, |
155 but thoughtless copying of your @file{.emacs} file will not inhibit the | 163 but thoughtless copying of your @file{.emacs} file will not inhibit the |
156 message for someone else. | 164 message for someone else. |
157 @end defopt | 165 @end defopt |
204 then the default library is not loaded. The default value is | 212 then the default library is not loaded. The default value is |
205 @code{nil}. | 213 @code{nil}. |
206 @end defopt | 214 @end defopt |
207 | 215 |
208 @defvar before-init-hook | 216 @defvar before-init-hook |
209 @defvarx after-init-hook | 217 This normal hook is run, once, just before loading of all the init files |
210 These two normal hooks are run just before, and just after, loading of | 218 (the user's init file, @file{default.el}, and/or @file{site-start.el}). |
211 the user's init file, @file{default.el}, and/or @file{site-start.el}. | 219 @end defvar |
220 | |
221 @defvar after-init-hook | |
222 This normal hook is run, once, just after loading of all the init files | |
223 (the user's init file, @file{default.el}, and/or @file{site-start.el}), | |
224 before the terminal-specific initialization. | |
212 @end defvar | 225 @end defvar |
213 | 226 |
214 @node Terminal-Specific | 227 @node Terminal-Specific |
215 @subsection Terminal-Specific Initialization | 228 @subsection Terminal-Specific Initialization |
216 @cindex terminal-specific initialization | 229 @cindex terminal-specific initialization |
217 | 230 |
218 Each terminal type can have its own Lisp library that Emacs loads when | 231 Each terminal type can have its own Lisp library that Emacs loads when |
219 run on that type of terminal. For a terminal type named @var{termtype}, | 232 run on that type of terminal. The library's name is constructed by |
220 the library is called @file{term/@var{termtype}}. Emacs finds the file | 233 concatenating the value of the variable @code{term-file-prefix} and the |
221 by searching the @code{load-path} directories as it does for other | 234 terminal type. Normally, @code{term-file-prefix} has the value |
222 files, and trying the @samp{.elc} and @samp{.el} suffixes. Normally, | 235 @code{"term/"}; changing this is not recommended. Emacs finds the file |
223 terminal-specific Lisp library is located in @file{emacs/lisp/term}, a | 236 in the normal manner, by searching the @code{load-path} directories, and |
224 subdirectory of the @file{emacs/lisp} directory in which most Emacs Lisp | 237 trying the @samp{.elc} and @samp{.el} suffixes. |
225 libraries are kept.@refill | |
226 | |
227 The library's name is constructed by concatenating the value of the | |
228 variable @code{term-file-prefix} and the terminal type. Normally, | |
229 @code{term-file-prefix} has the value @code{"term/"}; changing this | |
230 is not recommended. | |
231 | 238 |
232 The usual function of a terminal-specific library is to enable special | 239 The usual function of a terminal-specific library is to enable special |
233 keys to send sequences that Emacs can recognize. It may also need to | 240 keys to send sequences that Emacs can recognize. It may also need to |
234 set or add to @code{function-key-map} if the Termcap entry does not | 241 set or add to @code{function-key-map} if the Termcap entry does not |
235 specify all the terminal's function keys. @xref{Terminal Input}. | 242 specify all the terminal's function keys. @xref{Terminal Input}. |
618 | 625 |
619 @defun system-name | 626 @defun system-name |
620 This function returns the name of the machine you are running on. | 627 This function returns the name of the machine you are running on. |
621 @example | 628 @example |
622 (system-name) | 629 (system-name) |
623 @result{} "prep.ai.mit.edu" | 630 @result{} "www.gnu.org" |
624 @end example | 631 @end example |
625 @end defun | 632 @end defun |
626 | 633 |
627 @vindex system-name | 634 @vindex system-name |
628 The symbol @code{system-name} is a variable as well as a function. In | 635 The symbol @code{system-name} is a variable as well as a function. In |
717 when Emacs can't find those directories in their standard installed | 724 when Emacs can't find those directories in their standard installed |
718 locations, but can find them in a directory related somehow to the one | 725 locations, but can find them in a directory related somehow to the one |
719 containing the Emacs executable. | 726 containing the Emacs executable. |
720 @end defvar | 727 @end defvar |
721 | 728 |
722 @defun load-average | 729 @defun load-average &optional use-float |
723 This function returns the current 1-minute, 5-minute and 15-minute load | 730 This function returns the current 1-minute, 5-minute and 15-minute load |
724 averages in a list. The values are integers that are 100 times the | 731 averages in a list. |
725 system load averages, which indicate the average number of processes | 732 |
726 trying to run. It would be more logical to use floating point numbers, | 733 By default, the values are integers that are 100 times the system load |
727 but this function was introduced before Emacs supported floating point | 734 averages, which indicate the average number of processes trying to run. |
728 numbers, and it is not worth changing it now. | 735 If @var{use-float} is non-@code{nil}, then they are returned |
736 as floating point numbers instead. | |
729 | 737 |
730 @example | 738 @example |
731 @group | 739 @group |
732 (load-average) | 740 (load-average) |
733 @result{} (169 48 36) | 741 @result{} (169 48 36) |
742 @end group | |
743 @group | |
744 (load-average t) | |
745 @result{} (1.69 0.48 0.36) | |
734 @end group | 746 @end group |
735 | 747 |
736 @group | 748 @group |
737 lewis@@rocky[5] % uptime | 749 lewis@@rocky[5] % uptime |
738 11:55am up 1 day, 19:37, 3 users, | 750 11:55am up 1 day, 19:37, 3 users, |
743 | 755 |
744 @defun emacs-pid | 756 @defun emacs-pid |
745 This function returns the process @sc{id} of the Emacs process. | 757 This function returns the process @sc{id} of the Emacs process. |
746 @end defun | 758 @end defun |
747 | 759 |
760 @defvar tty-erase-char | |
748 @tindex tty-erase-char | 761 @tindex tty-erase-char |
749 @defvar tty-erase-char | |
750 This variable holds the erase character that was selected | 762 This variable holds the erase character that was selected |
751 in the system's terminal driver, before Emacs was started. | 763 in the system's terminal driver, before Emacs was started. |
752 @end defvar | 764 @end defvar |
753 | 765 |
754 @defun setprv privilege-name &optional setp getprv | 766 @defun setprv privilege-name &optional setp getprv |
857 | 869 |
858 This section explains how to determine the current time and the time | 870 This section explains how to determine the current time and the time |
859 zone. | 871 zone. |
860 | 872 |
861 @defun current-time-string &optional time-value | 873 @defun current-time-string &optional time-value |
862 This function returns the current time and date as a humanly-readable | 874 This function returns the current time and date as a human-readable |
863 string. The format of the string is unvarying; the number of characters | 875 string. The format of the string is unvarying; the number of characters |
864 used for each part is always the same, so you can reliably use | 876 used for each part is always the same, so you can reliably use |
865 @code{substring} to extract pieces of it. It is wise to count the | 877 @code{substring} to extract pieces of it. It is wise to count the |
866 characters from the beginning of the string rather than from the end, as | 878 characters from the beginning of the string rather than from the end, as |
867 additional information may some day be added at the end. | 879 additional information may some day be added at the end. |
1025 @end table | 1037 @end table |
1026 | 1038 |
1027 You can also specify the field width and type of padding for any of | 1039 You can also specify the field width and type of padding for any of |
1028 these @samp{%}-sequences. This works as in @code{printf}: you write | 1040 these @samp{%}-sequences. This works as in @code{printf}: you write |
1029 the field width as digits in the middle of a @samp{%}-sequences. If you | 1041 the field width as digits in the middle of a @samp{%}-sequences. If you |
1030 start the field width with 0, it means to pad with zeros. | 1042 start the field width with @samp{0}, it means to pad with zeros. If you |
1043 start the field width with @samp{_}, it means to pad with spaces. | |
1031 | 1044 |
1032 For example, @samp{%S} specifies the number of seconds since the minute; | 1045 For example, @samp{%S} specifies the number of seconds since the minute; |
1033 @samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to | 1046 @samp{%03S} means to pad this with zeros to 3 positions, @samp{%_3S} to |
1034 pad with spaces to 3 positions. Plain @samp{%3S} pads with zeros, | 1047 pad with spaces to 3 positions. Plain @samp{%3S} pads with zeros, |
1035 because that is how @samp{%S} normally pads to two positions. | 1048 because that is how @samp{%S} normally pads to two positions. |
1099 @end example | 1112 @end example |
1100 | 1113 |
1101 You can perform simple date arithmetic by using out-of-range values for | 1114 You can perform simple date arithmetic by using out-of-range values for |
1102 the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} | 1115 the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} |
1103 arguments; for example, day 0 means the day preceding the given month. | 1116 arguments; for example, day 0 means the day preceding the given month. |
1117 | |
1118 The operating system puts limits on the range of possible time values; | |
1119 if you try to encode a time that is out of range, an error results. | |
1104 @end defun | 1120 @end defun |
1105 | 1121 |
1106 @node Timers | 1122 @node Timers |
1107 @section Timers for Delayed Execution | 1123 @section Timers for Delayed Execution |
1108 @cindex timer | 1124 @cindex timer |
1122 at time @var{time}. The argument @var{function} is a function to call | 1138 at time @var{time}. The argument @var{function} is a function to call |
1123 later, and @var{args} are the arguments to give it when it is called. | 1139 later, and @var{args} are the arguments to give it when it is called. |
1124 The time @var{time} is specified as a string. | 1140 The time @var{time} is specified as a string. |
1125 | 1141 |
1126 Absolute times may be specified in a wide variety of formats, and tries | 1142 Absolute times may be specified in a wide variety of formats, and tries |
1127 to accept all common date formats. One valid format is | 1143 to accept all common date formats. Valid formats include these two, |
1128 @samp{@var{hour}:@var{min}:@var{sec} @var{timezone} | 1144 |
1129 @var{month}/@var{day}/@var{year}}, where all fields are numbers; the | 1145 @example |
1130 format that @code{current-time-string} returns is also allowed. | 1146 @var{year}-@var{month}-@var{day} @var{hour}:@var{min}:@var{sec} @var{timezone} |
1147 | |
1148 @var{hour}:@var{min}:@var{sec} @var{timezone} @var{month}/@var{day}/@var{year} | |
1149 @end example | |
1150 | |
1151 @noindent | |
1152 where in both examples all fields are numbers; the format that | |
1153 @code{current-time-string} returns is also allowed, and many others | |
1154 as well. | |
1131 | 1155 |
1132 To specify a relative time, use numbers followed by units. | 1156 To specify a relative time, use numbers followed by units. |
1133 For example: | 1157 For example: |
1134 | 1158 |
1135 @table @samp | 1159 @table @samp |
1166 the value of the last form in @var{body}. If, however, the execution of | 1190 the value of the last form in @var{body}. If, however, the execution of |
1167 @var{body} is cut short by the timeout, then @code{with-timeout} | 1191 @var{body} is cut short by the timeout, then @code{with-timeout} |
1168 executes all the @var{timeout-forms} and returns the value of the last | 1192 executes all the @var{timeout-forms} and returns the value of the last |
1169 of them. | 1193 of them. |
1170 | 1194 |
1171 This macro works by set a timer to run after @var{seconds} seconds. If | 1195 This macro works by setting a timer to run after @var{seconds} seconds. If |
1172 @var{body} finishes before that time, it cancels the timer. If the | 1196 @var{body} finishes before that time, it cancels the timer. If the |
1173 timer actually runs, it terminates execution of @var{body}, then | 1197 timer actually runs, it terminates execution of @var{body}, then |
1174 executes @var{timeout-forms}. | 1198 executes @var{timeout-forms}. |
1175 | 1199 |
1176 Since timers can run within a Lisp program only when the program calls a | 1200 Since timers can run within a Lisp program only when the program calls a |
1288 @item interrupt | 1312 @item interrupt |
1289 is non-@code{nil} when Emacs is using interrupt-driven input. If | 1313 is non-@code{nil} when Emacs is using interrupt-driven input. If |
1290 @code{nil}, Emacs is using @sc{cbreak} mode. | 1314 @code{nil}, Emacs is using @sc{cbreak} mode. |
1291 @item flow | 1315 @item flow |
1292 is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) | 1316 is non-@code{nil} if Emacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s}) |
1293 flow control for output to the terminal. This value has effect when | 1317 flow control for output to the terminal. This value is meaningful only |
1294 unless @var{interrupt} is @code{nil}. | 1318 when @var{interrupt} is @code{nil}. |
1295 @item meta | 1319 @item meta |
1296 is @code{t} if Emacs treats the eighth bit of input characters as | 1320 is @code{t} if Emacs treats the eighth bit of input characters as |
1297 the meta bit; @code{nil} means Emacs clears the eighth bit of every | 1321 the meta bit; @code{nil} means Emacs clears the eighth bit of every |
1298 input character; any other value means Emacs uses all eight bits as the | 1322 input character; any other value means Emacs uses all eight bits as the |
1299 basic character code. | 1323 basic character code. |
1363 "Replace C-s with C-\ and C-q with C-^." | 1387 "Replace C-s with C-\ and C-q with C-^." |
1364 (interactive) | 1388 (interactive) |
1365 @end group | 1389 @end group |
1366 @group | 1390 @group |
1367 (setq keyboard-translate-table | 1391 (setq keyboard-translate-table |
1368 (make-char-table 'keyboard-translate-table nil))) | 1392 (make-char-table 'keyboard-translate-table nil)) |
1369 @end group | 1393 @end group |
1370 @group | 1394 @group |
1371 ;; @r{Swap @kbd{C-s} and @kbd{C-\}.} | 1395 ;; @r{Swap @kbd{C-s} and @kbd{C-\}.} |
1372 (aset keyboard-translate-table ?\034 ?\^s) | 1396 (aset keyboard-translate-table ?\034 ?\^s) |
1373 (aset keyboard-translate-table ?\^s ?\034) | 1397 (aset keyboard-translate-table ?\^s ?\034) |