Mercurial > emacs
comparison lispref/os.texi @ 25751:467b88fab665
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 17 Sep 1999 06:59:04 +0000 |
parents | dcb2b7cbddca |
children | 6a17c48b52ef |
comparison
equal
deleted
inserted
replaced
25750:f1968a807f56 | 25751:467b88fab665 |
---|---|
13 @xref{Building Emacs}, for related information. See also | 13 @xref{Building Emacs}, for related information. See also |
14 @ref{Display}, for additional operating system status information | 14 @ref{Display}, for additional operating system status information |
15 pertaining to the terminal and the screen. | 15 pertaining to the terminal and the screen. |
16 | 16 |
17 @menu | 17 @menu |
18 * Starting Up:: Customizing Emacs start-up processing. | 18 * Starting Up:: Customizing Emacs startup processing. |
19 * Getting Out:: How exiting works (permanent or temporary). | 19 * Getting Out:: How exiting works (permanent or temporary). |
20 * System Environment:: Distinguish the name and kind of system. | 20 * System Environment:: Distinguish the name and kind of system. |
21 * User Identification:: Finding the name and user id of the user. | 21 * User Identification:: Finding the name and user id of the user. |
22 * Time of Day:: Getting the current time. | 22 * Time of Day:: Getting the current time. |
23 * Time Conversion:: Converting a time from numeric form to a string, or | 23 * Time Conversion:: Converting a time from numeric form to a string, or |
24 to calendrical data (or vice versa). | 24 to calendrical data (or vice versa). |
25 * Timers:: Setting a timer to call a function at a certain time. | 25 * Timers:: Setting a timer to call a function at a certain time. |
26 * Terminal Input:: Recording terminal input for debugging. | 26 * Terminal Input:: Recording terminal input for debugging. |
27 * Terminal Output:: Recording terminal output for debugging. | 27 * Terminal Output:: Recording terminal output for debugging. |
28 * Sound Output:: Playing sounds on the computer's speaker. | |
28 * Special Keysyms:: Defining system-specific key symbols for X windows. | 29 * Special Keysyms:: Defining system-specific key symbols for X windows. |
29 * Flow Control:: How to turn output flow control on or off. | 30 * Flow Control:: How to turn output flow control on or off. |
30 * Batch Mode:: Running Emacs without terminal interaction. | 31 * Batch Mode:: Running Emacs without terminal interaction. |
31 @end menu | 32 @end menu |
32 | 33 |
35 | 36 |
36 This section describes what Emacs does when it is started, and how you | 37 This section describes what Emacs does when it is started, and how you |
37 can customize these actions. | 38 can customize these actions. |
38 | 39 |
39 @menu | 40 @menu |
40 * Start-up Summary:: Sequence of actions Emacs performs at start-up. | 41 * Startup Summary:: Sequence of actions Emacs performs at startup. |
41 * Init File:: Details on reading the init file (@file{.emacs}). | 42 * Init File:: Details on reading the init file (@file{.emacs}). |
42 * Terminal-Specific:: How the terminal-specific Lisp file is read. | 43 * Terminal-Specific:: How the terminal-specific Lisp file is read. |
43 * Command Line Arguments:: How command line arguments are processed, | 44 * Command-Line Arguments:: How command-line arguments are processed, |
44 and how you can customize them. | 45 and how you can customize them. |
45 @end menu | 46 @end menu |
46 | 47 |
47 @node Start-up Summary | 48 @node Startup Summary |
48 @subsection Summary: Sequence of Actions at Start Up | 49 @subsection Summary: Sequence of Actions at Startup |
49 @cindex initialization | 50 @cindex initialization |
50 @cindex start up of Emacs | 51 @cindex startup of Emacs |
51 @cindex @file{startup.el} | 52 @cindex @file{startup.el} |
52 | 53 |
53 The order of operations performed (in @file{startup.el}) by Emacs when | 54 The order of operations performed (in @file{startup.el}) by Emacs when |
54 it is started up is as follows: | 55 it is started up is as follows: |
55 | 56 |
84 @cindex @file{site-start.el} | 85 @cindex @file{site-start.el} |
85 | 86 |
86 @item | 87 @item |
87 It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was | 88 It loads the file @file{~/.emacs}, unless @samp{-q} or @samp{-batch} was |
88 specified on the command line. The @samp{-u} option can specify another | 89 specified on the command line. The @samp{-u} option can specify another |
89 user name whose home directory should be used instead of @file{~}. | 90 user whose home directory should be used instead of @file{~}. |
90 | 91 |
91 @item | 92 @item |
92 It loads the library @file{default}, unless @code{inhibit-default-init} | 93 It loads the library @file{default}, unless @code{inhibit-default-init} |
93 is non-@code{nil}. (This is not done in @samp{-batch} mode or if | 94 is non-@code{nil}. (This is not done in @samp{-batch} mode or if |
94 @samp{-q} was specified on the command line.) The library's file name | 95 @samp{-q} was specified on the command line.) The library's file name |
125 @item | 126 @item |
126 It runs @code{window-setup-hook}. @xref{Window Systems}. | 127 It runs @code{window-setup-hook}. @xref{Window Systems}. |
127 | 128 |
128 @item | 129 @item |
129 It displays copyleft, nonwarranty, and basic use information, provided | 130 It displays copyleft, nonwarranty, and basic use information, provided |
130 there were no remaining command line arguments (a few steps above), | 131 there were no remaining command-line arguments (a few steps above), |
131 the value of @code{inhibit-startup-message} is @code{nil}, and the | 132 the value of @code{inhibit-startup-message} is @code{nil}, and the |
132 buffer is still empty. | 133 buffer is still empty. |
133 @end enumerate | 134 @end enumerate |
134 | 135 |
135 @defopt inhibit-startup-message | 136 @defopt inhibit-startup-message |
168 @subsection The Init File: @file{.emacs} | 169 @subsection The Init File: @file{.emacs} |
169 @cindex init file | 170 @cindex init file |
170 @cindex @file{.emacs} | 171 @cindex @file{.emacs} |
171 | 172 |
172 When you start Emacs, it normally attempts to load the file | 173 When you start Emacs, it normally attempts to load the file |
173 @file{.emacs} from your home directory. This file, if it exists, must | 174 @file{.emacs} from your home directory. This file is called your |
174 contain Lisp code. It is called your @dfn{init file}. The command line | 175 @dfn{init file}. If it exists, it must contain Lisp code. The |
175 switches @samp{-q} and @samp{-u} affect the use of the init file; | 176 command-line switches @samp{-q} and @samp{-u} affect the use of the init |
176 @samp{-q} says not to load an init file, and @samp{-u} says to load a | 177 file; @samp{-q} says not to load an init file, and @samp{-u} says to |
177 specified user's init file instead of yours. @xref{Entering Emacs,,, | 178 load a specified user's init file instead of yours. @xref{Entering |
178 emacs, The GNU Emacs Manual}. | 179 Emacs,,, emacs, The GNU Emacs Manual}. |
179 | 180 |
180 @cindex default init file | 181 @cindex default init file |
181 A site may have a @dfn{default init file}, which is the library named | 182 A site may have a @dfn{default init file}, which is the library named |
182 @file{default.el}. Emacs finds the @file{default.el} file through the | 183 @file{default.el}. Emacs finds the @file{default.el} file through the |
183 standard search path for libraries (@pxref{How Programs Do Loading}). | 184 standard search path for libraries (@pxref{How Programs Do Loading}). |
198 way you can change it with real effect is to do so before dumping | 199 way you can change it with real effect is to do so before dumping |
199 Emacs. | 200 Emacs. |
200 @end defvar | 201 @end defvar |
201 | 202 |
202 If there is a great deal of code in your @file{.emacs} file, you | 203 If there is a great deal of code in your @file{.emacs} file, you |
203 should move it into another file named @file{@var{something}.el}, | 204 can make it load faster by renaming it to @file{.emacs.el} |
204 byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs} | 205 and then byte-compiling it (@pxref{Byte Compilation}). |
205 file load the other file using @code{load} (@pxref{Loading}). | |
206 | 206 |
207 @xref{Init File Examples,,, emacs, The GNU Emacs Manual}, for | 207 @xref{Init File Examples,,, emacs, The GNU Emacs Manual}, for |
208 examples of how to make various commonly desired customizations in your | 208 examples of how to make various commonly desired customizations in your |
209 @file{.emacs} file. | 209 @file{.emacs} file. |
210 | 210 |
232 @cindex terminal-specific initialization | 232 @cindex terminal-specific initialization |
233 | 233 |
234 Each terminal type can have its own Lisp library that Emacs loads when | 234 Each terminal type can have its own Lisp library that Emacs loads when |
235 run on that type of terminal. The library's name is constructed by | 235 run on that type of terminal. The library's name is constructed by |
236 concatenating the value of the variable @code{term-file-prefix} and the | 236 concatenating the value of the variable @code{term-file-prefix} and the |
237 terminal type. Normally, @code{term-file-prefix} has the value | 237 terminal type (specified by the environment variable @code{TERM}). |
238 Normally, @code{term-file-prefix} has the value | |
238 @code{"term/"}; changing this is not recommended. Emacs finds the file | 239 @code{"term/"}; changing this is not recommended. Emacs finds the file |
239 in the normal manner, by searching the @code{load-path} directories, and | 240 in the normal manner, by searching the @code{load-path} directories, and |
240 trying the @samp{.elc} and @samp{.el} suffixes. | 241 trying the @samp{.elc} and @samp{.el} suffixes. |
241 | 242 |
242 The usual function of a terminal-specific library is to enable special | 243 The usual function of a terminal-specific library is to enable special |
277 @noindent | 278 @noindent |
278 You may set the @code{term-file-prefix} variable to @code{nil} in your | 279 You may set the @code{term-file-prefix} variable to @code{nil} in your |
279 @file{.emacs} file if you do not wish to load the | 280 @file{.emacs} file if you do not wish to load the |
280 terminal-initialization file. To do this, put the following in | 281 terminal-initialization file. To do this, put the following in |
281 your @file{.emacs} file: @code{(setq term-file-prefix nil)}. | 282 your @file{.emacs} file: @code{(setq term-file-prefix nil)}. |
283 | |
284 On MS-DOS, if the environment variable @code{TERM} is not set, Emacs | |
285 uses @samp{internal} as the terminal type. | |
282 @end defvar | 286 @end defvar |
283 | 287 |
284 @defvar term-setup-hook | 288 @defvar term-setup-hook |
285 This variable is a normal hook that Emacs runs after loading your | 289 This variable is a normal hook that Emacs runs after loading your |
286 @file{.emacs} file, the default initialization file (if any) and the | 290 @file{.emacs} file, the default initialization file (if any) and the |
291 @end defvar | 295 @end defvar |
292 | 296 |
293 See @code{window-setup-hook} in @ref{Window Systems}, for a related | 297 See @code{window-setup-hook} in @ref{Window Systems}, for a related |
294 feature. | 298 feature. |
295 | 299 |
296 @node Command Line Arguments | 300 @node Command-Line Arguments |
297 @subsection Command Line Arguments | 301 @subsection Command-Line Arguments |
298 @cindex command line arguments | 302 @cindex command-line arguments |
299 | 303 |
300 You can use command line arguments to request various actions when you | 304 You can use command-line arguments to request various actions when you |
301 start Emacs. Since you do not need to start Emacs more than once per | 305 start Emacs. Since you do not need to start Emacs more than once per |
302 day, and will often leave your Emacs session running longer than that, | 306 day, and will often leave your Emacs session running longer than that, |
303 command line arguments are hardly ever used. As a practical matter, it | 307 command-line arguments are hardly ever used. As a practical matter, it |
304 is best to avoid making the habit of using them, since this habit would | 308 is best to avoid making the habit of using them, since this habit would |
305 encourage you to kill and restart Emacs unnecessarily often. These | 309 encourage you to kill and restart Emacs unnecessarily often. These |
306 options exist for two reasons: to be compatible with other editors (for | 310 options exist for two reasons: to be compatible with other editors (for |
307 invocation by other programs) and to enable shell scripts to run | 311 invocation by other programs) and to enable shell scripts to run |
308 specific Lisp programs. | 312 specific Lisp programs. |
309 | 313 |
310 This section describes how Emacs processes command line arguments, | 314 This section describes how Emacs processes command-line arguments, |
311 and how you can customize them. | 315 and how you can customize them. |
312 | 316 |
313 @ignore | 317 @ignore |
314 (Note that some other editors require you to start afresh each time | 318 (Note that some other editors require you to start afresh each time |
315 you want to edit a file. With this kind of editor, you will probably | 319 you want to edit a file. With this kind of editor, you will probably |
316 specify the file as a command line argument. The recommended way to | 320 specify the file as a command-line argument. The recommended way to |
317 use GNU Emacs is to start it only once, just after you log in, and do | 321 use GNU Emacs is to start it only once, just after you log in, and do |
318 all your editing in the same Emacs process. Each time you want to edit | 322 all your editing in the same Emacs process. Each time you want to edit |
319 a different file, you visit it with the existing Emacs, which eventually | 323 a different file, you visit it with the existing Emacs, which eventually |
320 comes to have many files in it ready for editing. Usually you do not | 324 comes to have many files in it ready for editing. Usually you do not |
321 kill the Emacs until you are about to log out.) | 325 kill the Emacs until you are about to log out.) |
331 The value of this variable is @code{t} once the command line has been | 335 The value of this variable is @code{t} once the command line has been |
332 processed. | 336 processed. |
333 | 337 |
334 If you redump Emacs by calling @code{dump-emacs}, you may wish to set | 338 If you redump Emacs by calling @code{dump-emacs}, you may wish to set |
335 this variable to @code{nil} first in order to cause the new dumped Emacs | 339 this variable to @code{nil} first in order to cause the new dumped Emacs |
336 to process its new command line arguments. | 340 to process its new command-line arguments. |
337 @end defvar | 341 @end defvar |
338 | 342 |
339 @defvar command-switch-alist | 343 @defvar command-switch-alist |
340 @cindex switches on command line | 344 @cindex switches on command line |
341 @cindex options on command line | 345 @cindex options on command line |
342 @cindex command line options | 346 @cindex command-line options |
343 The value of this variable is an alist of user-defined command-line | 347 The value of this variable is an alist of user-defined command-line |
344 options and associated handler functions. This variable exists so you | 348 options and associated handler functions. This variable exists so you |
345 can add elements to it. | 349 can add elements to it. |
346 | 350 |
347 A @dfn{command line option} is an argument on the command line of the | 351 A @dfn{command-line option} is an argument on the command line, which |
348 form: | 352 has the form: |
349 | 353 |
350 @example | 354 @example |
351 -@var{option} | 355 -@var{option} |
352 @end example | 356 @end example |
353 | 357 |
355 | 359 |
356 @example | 360 @example |
357 (@var{option} . @var{handler-function}) | 361 (@var{option} . @var{handler-function}) |
358 @end example | 362 @end example |
359 | 363 |
360 The @var{handler-function} is called to handle @var{option} and receives | 364 The @sc{car}, @var{option}, is a string, the name of a command-line |
361 the option name as its sole argument. | 365 option (not including the initial hyphen). The @var{handler-function} |
366 is called to handle @var{option}, and receives the option name as its | |
367 sole argument. | |
362 | 368 |
363 In some cases, the option is followed in the command line by an | 369 In some cases, the option is followed in the command line by an |
364 argument. In these cases, the @var{handler-function} can find all the | 370 argument. In these cases, the @var{handler-function} can find all the |
365 remaining command-line arguments in the variable | 371 remaining command-line arguments in the variable |
366 @code{command-line-args-left}. (The entire list of command-line | 372 @code{command-line-args-left}. (The entire list of command-line |
367 arguments is in @code{command-line-args}.) | 373 arguments is in @code{command-line-args}.) |
368 | 374 |
369 The command line arguments are parsed by the @code{command-line-1} | 375 The command-line arguments are parsed by the @code{command-line-1} |
370 function in the @file{startup.el} file. See also @ref{Command | 376 function in the @file{startup.el} file. See also @ref{Command |
371 Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs | 377 Switches, , Command Line Switches and Arguments, emacs, The GNU Emacs |
372 Manual}. | 378 Manual}. |
373 @end defvar | 379 @end defvar |
374 | 380 |
375 @defvar command-line-args | 381 @defvar command-line-args |
376 The value of this variable is the list of command line arguments passed | 382 The value of this variable is the list of command-line arguments passed |
377 to Emacs. | 383 to Emacs. |
378 @end defvar | 384 @end defvar |
379 | 385 |
380 @defvar command-line-functions | 386 @defvar command-line-functions |
381 This variable's value is a list of functions for handling an | 387 This variable's value is a list of functions for handling an |
434 terminal input buffer so that the shell (or whatever program next reads | 440 terminal input buffer so that the shell (or whatever program next reads |
435 input) can read them. | 441 input) can read them. |
436 @end defun | 442 @end defun |
437 | 443 |
438 All the information in the Emacs process, aside from files that have | 444 All the information in the Emacs process, aside from files that have |
439 been saved, is lost when the Emacs is killed. Because killing Emacs | 445 been saved, is lost when the Emacs process is killed. Because killing |
440 inadvertently can lose a lot of work, Emacs queries for confirmation | 446 Emacs inadvertently can lose a lot of work, Emacs queries for |
441 before actually terminating if you have buffers that need saving or | 447 confirmation before actually terminating if you have buffers that need |
442 subprocesses that are running. This is done in the function | 448 saving or subprocesses that are running. This is done in the function |
443 @code{save-buffers-kill-emacs}. | 449 @code{save-buffers-kill-emacs}. |
444 | 450 |
445 @defvar kill-emacs-query-functions | 451 @defvar kill-emacs-query-functions |
446 After asking the standard questions, @code{save-buffers-kill-emacs} | 452 After asking the standard questions, @code{save-buffers-kill-emacs} |
447 calls the functions in the list @code{kill-emacs-query-functions}, in | 453 calls the functions in the list @code{kill-emacs-query-functions}, in |
473 | 479 |
474 Suspension is not useful with window systems, because the Emacs job | 480 Suspension is not useful with window systems, because the Emacs job |
475 may not have a parent that can resume it again, and in any case you can | 481 may not have a parent that can resume it again, and in any case you can |
476 give input to some other job such as a shell merely by moving to a | 482 give input to some other job such as a shell merely by moving to a |
477 different window. Therefore, suspending is not allowed when Emacs is using | 483 different window. Therefore, suspending is not allowed when Emacs is using |
478 a window system. | 484 a window system (X Windows or MS Windows). |
479 | 485 |
480 @defun suspend-emacs string | 486 @defun suspend-emacs string |
481 This function stops Emacs and returns control to the superior process. | 487 This function stops Emacs and returns control to the superior process. |
482 If and when the superior process resumes Emacs, @code{suspend-emacs} | 488 If and when the superior process resumes Emacs, @code{suspend-emacs} |
483 returns @code{nil} to its caller in Lisp. | 489 returns @code{nil} to its caller in Lisp. |
543 @end group | 549 @end group |
544 @end smallexample | 550 @end smallexample |
545 @end defun | 551 @end defun |
546 | 552 |
547 @defvar suspend-hook | 553 @defvar suspend-hook |
548 This variable is a normal hook run before suspending. | 554 This variable is a normal hook that Emacs runs before suspending. |
549 @end defvar | 555 @end defvar |
550 | 556 |
551 @defvar suspend-resume-hook | 557 @defvar suspend-resume-hook |
552 This variable is a normal hook run after suspending. | 558 This variable is a normal hook that Emacs runs on resuming |
559 after a suspension. | |
553 @end defvar | 560 @end defvar |
554 | 561 |
555 @node System Environment | 562 @node System Environment |
556 @section Operating System Environment | 563 @section Operating System Environment |
557 @cindex operating system environment | 564 @cindex operating system environment |
596 | 603 |
597 @item irix | 604 @item irix |
598 Silicon Graphics Irix system. | 605 Silicon Graphics Irix system. |
599 | 606 |
600 @item ms-dos | 607 @item ms-dos |
601 Microsoft MS-DOS ``operating system.'' | 608 Microsoft MS-DOS ``operating system.'' Emacs compiled with DJGPP for |
609 MS-DOS binds @code{system-type} to @code{ms-dos} even when you run it on | |
610 MS-Windows. | |
602 | 611 |
603 @item next-mach | 612 @item next-mach |
604 NeXT Mach-based system. | 613 NeXT Mach-based system. |
605 | 614 |
606 @item rtu | 615 @item rtu |
614 | 623 |
615 @item vax-vms | 624 @item vax-vms |
616 VAX VMS. | 625 VAX VMS. |
617 | 626 |
618 @item windows-nt | 627 @item windows-nt |
619 Microsoft windows NT. | 628 Microsoft windows NT. The same executable supports Windows 9X, but the |
629 value of @code{system-type} is @code{windows-nt} in either case. | |
620 | 630 |
621 @item xenix | 631 @item xenix |
622 SCO Xenix 386. | 632 SCO Xenix 386. |
623 @end table | 633 @end table |
624 | 634 |
708 | 718 |
709 @defvar path-separator | 719 @defvar path-separator |
710 This variable holds a string which says which character separates | 720 This variable holds a string which says which character separates |
711 directories in a search path (as found in an environment variable). Its | 721 directories in a search path (as found in an environment variable). Its |
712 value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS | 722 value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS |
713 and Windows NT. | 723 and MS-Windows. |
714 @end defvar | 724 @end defvar |
715 | 725 |
716 @defvar invocation-name | 726 @defvar invocation-name |
717 This variable holds the program name under which Emacs was invoked. The | 727 This variable holds the program name under which Emacs was invoked. The |
718 value is a string, and does not include a directory name. | 728 value is a string, and does not include a directory name. |
768 in the system's terminal driver, before Emacs was started. | 778 in the system's terminal driver, before Emacs was started. |
769 @end defvar | 779 @end defvar |
770 | 780 |
771 @defun setprv privilege-name &optional setp getprv | 781 @defun setprv privilege-name &optional setp getprv |
772 This function sets or resets a VMS privilege. (It does not exist on | 782 This function sets or resets a VMS privilege. (It does not exist on |
773 Unix.) The first arg is the privilege name, as a string. The second | 783 other systems.) The first argument is the privilege name, as a string. |
774 argument, @var{setp}, is @code{t} or @code{nil}, indicating whether the | 784 The second argument, @var{setp}, is @code{t} or @code{nil}, indicating |
775 privilege is to be turned on or off. Its default is @code{nil}. The | 785 whether the privilege is to be turned on or off. Its default is |
776 function returns @code{t} if successful, @code{nil} otherwise. | 786 @code{nil}. The function returns @code{t} if successful, @code{nil} |
787 otherwise. | |
777 | 788 |
778 If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv} | 789 If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv} |
779 does not change the privilege, but returns @code{t} or @code{nil} | 790 does not change the privilege, but returns @code{t} or @code{nil} |
780 indicating whether the privilege is currently enabled. | 791 indicating whether the privilege is currently enabled. |
781 @end defun | 792 @end defun |
783 @node User Identification | 794 @node User Identification |
784 @section User Identification | 795 @section User Identification |
785 | 796 |
786 @defvar init-file-user | 797 @defvar init-file-user |
787 This variable says which user's init files should be used by Emacs---or | 798 This variable says which user's init files should be used by Emacs---or |
788 @code{nil} if none. The value reflects command line options such as | 799 @code{nil} if none. The value reflects command-line options such as |
789 @samp{-q} or @samp{-u @var{user}}. | 800 @samp{-q} or @samp{-u @var{user}}. |
790 | 801 |
791 Lisp packages that load files of customizations, or any other sort of | 802 Lisp packages that load files of customizations, or any other sort of |
792 user profile, should obey this variable in deciding where to find it. | 803 user profile, should obey this variable in deciding where to find it. |
793 They should load the profile of the user name found in this variable. | 804 They should load the profile of the user name found in this variable. |
828 environment variables @code{LOGNAME} and @code{USER}. | 839 environment variables @code{LOGNAME} and @code{USER}. |
829 @end defun | 840 @end defun |
830 | 841 |
831 @defun user-full-name &optional uid | 842 @defun user-full-name &optional uid |
832 This function returns the full name of the logged-in user---or the value | 843 This function returns the full name of the logged-in user---or the value |
833 of the environment variables @code{NAME}, if that is set. | 844 of the environment variable @code{NAME}, if that is set. |
834 | 845 |
846 @c "Bil" is the correct spelling. | |
835 @example | 847 @example |
836 @group | 848 @group |
837 (user-full-name) | 849 (user-full-name) |
838 @result{} "Bil Lewis" | 850 @result{} "Bil Lewis" |
839 @end group | 851 @end group |
905 @c Emacs 19 feature | 917 @c Emacs 19 feature |
906 @defun current-time | 918 @defun current-time |
907 This function returns the system's time value as a list of three | 919 This function returns the system's time value as a list of three |
908 integers: @code{(@var{high} @var{low} @var{microsec})}. The integers | 920 integers: @code{(@var{high} @var{low} @var{microsec})}. The integers |
909 @var{high} and @var{low} combine to give the number of seconds since | 921 @var{high} and @var{low} combine to give the number of seconds since |
910 0:00 January 1, 1970, which is | 922 0:00 January 1, 1970 (local time), which is |
911 @ifinfo | 923 @ifinfo |
912 @var{high} * 2**16 + @var{low}. | 924 @var{high} * 2**16 + @var{low}. |
913 @end ifinfo | 925 @end ifinfo |
914 @tex | 926 @tex |
915 $high*2^{16}+low$. | 927 $high*2^{16}+low$. |
916 @end tex | 928 @end tex |
917 | 929 |
918 The third element, @var{microsec}, gives the microseconds since the | 930 The third element, @var{microsec}, gives the microseconds since the |
919 start of the current second (or 0 for systems that return time only on | 931 start of the current second (or 0 for systems that return time with |
920 the resolution of a second). | 932 the resolution of only one second). |
921 | 933 |
922 The first two elements can be compared with file time values such as you | 934 The first two elements can be compared with file time values such as you |
923 get with the function @code{file-attributes}. @xref{File Attributes}. | 935 get with the function @code{file-attributes}. @xref{File Attributes}. |
924 @end defun | 936 @end defun |
925 | 937 |
929 in. | 941 in. |
930 | 942 |
931 The value has the form @code{(@var{offset} @var{name})}. Here | 943 The value has the form @code{(@var{offset} @var{name})}. Here |
932 @var{offset} is an integer giving the number of seconds ahead of UTC | 944 @var{offset} is an integer giving the number of seconds ahead of UTC |
933 (east of Greenwich). A negative value means west of Greenwich. The | 945 (east of Greenwich). A negative value means west of Greenwich. The |
934 second element, @var{name} is a string giving the name of the time | 946 second element, @var{name}, is a string giving the name of the time |
935 zone. Both elements change when daylight savings time begins or ends; | 947 zone. Both elements change when daylight savings time begins or ends; |
936 if the user has specified a time zone that does not use a seasonal time | 948 if the user has specified a time zone that does not use a seasonal time |
937 adjustment, then the value is constant through time. | 949 adjustment, then the value is constant through time. |
938 | 950 |
939 If the operating system doesn't supply all the information necessary to | 951 If the operating system doesn't supply all the information necessary to |
996 @item %h | 1008 @item %h |
997 This is a synonym for @samp{%b}. | 1009 This is a synonym for @samp{%b}. |
998 @item %H | 1010 @item %H |
999 This stands for the hour (00-23). | 1011 This stands for the hour (00-23). |
1000 @item %I | 1012 @item %I |
1001 This stands for the hour (00-12). | 1013 This stands for the hour (01-12). |
1002 @item %j | 1014 @item %j |
1003 This stands for the day of the year (001-366). | 1015 This stands for the day of the year (001-366). |
1004 @item %k | 1016 @item %k |
1005 This stands for the hour (0-23), blank padded. | 1017 This stands for the hour (0-23), blank padded. |
1006 @item %l | 1018 @item %l |
1016 @item %r | 1028 @item %r |
1017 This is a synonym for @samp{%I:%M:%S %p}. | 1029 This is a synonym for @samp{%I:%M:%S %p}. |
1018 @item %R | 1030 @item %R |
1019 This is a synonym for @samp{%H:%M}. | 1031 This is a synonym for @samp{%H:%M}. |
1020 @item %S | 1032 @item %S |
1021 This stands for the seconds (00-60). | 1033 This stands for the seconds (00-59). |
1022 @item %t | 1034 @item %t |
1023 This stands for a tab character. | 1035 This stands for a tab character. |
1024 @item %T | 1036 @item %T |
1025 This is a synonym for @samp{%H:%M:%S}. | 1037 This is a synonym for @samp{%H:%M:%S}. |
1026 @item %U | 1038 @item %U |
1066 @end example | 1078 @end example |
1067 | 1079 |
1068 Here is what the elements mean: | 1080 Here is what the elements mean: |
1069 | 1081 |
1070 @table @var | 1082 @table @var |
1071 @item sec | 1083 @item seconds |
1072 The number of seconds past the minute, as an integer between 0 and 59. | 1084 The number of seconds past the minute, as an integer between 0 and 59. |
1073 @item minute | 1085 @item minutes |
1074 The number of minutes past the hour, as an integer between 0 and 59. | 1086 The number of minutes past the hour, as an integer between 0 and 59. |
1075 @item hour | 1087 @item hour |
1076 The hour of the day, as an integer between 0 and 23. | 1088 The hour of the day, as an integer between 0 and 23. |
1077 @item day | 1089 @item day |
1078 The day of the month, as an integer between 1 and 31. | 1090 The day of the month, as an integer between 1 and 31. |
1097 @defun encode-time seconds minutes hour day month year &optional @dots{}zone | 1109 @defun encode-time seconds minutes hour day month year &optional @dots{}zone |
1098 This function is the inverse of @code{decode-time}. It converts seven | 1110 This function is the inverse of @code{decode-time}. It converts seven |
1099 items of calendrical data into a time value. For the meanings of the | 1111 items of calendrical data into a time value. For the meanings of the |
1100 arguments, see the table above under @code{decode-time}. | 1112 arguments, see the table above under @code{decode-time}. |
1101 | 1113 |
1102 Year numbers less than 100 are treated just like other year numbers. If | 1114 Year numbers less than 100 are not treated specially. If you want them |
1103 you want them to stand for years above 1900, you must alter them yourself | 1115 to stand for years above 1900, you must alter them yourself before you |
1104 before you call @code{encode-time}. | 1116 call @code{encode-time}. |
1105 | 1117 |
1106 The optional argument @var{zone} defaults to the current time zone and | 1118 The optional argument @var{zone} defaults to the current time zone and |
1107 its daylight savings time rules. If specified, it can be either a list | 1119 its daylight savings time rules. If specified, it can be either a list |
1108 (as you would get from @code{current-time-zone}), a string as in the | 1120 (as you would get from @code{current-time-zone}), a string as in the |
1109 @code{TZ} environment variable, or an integer (as you would get from | 1121 @code{TZ} environment variable, or an integer (as you would get from |
1119 @example | 1131 @example |
1120 (apply 'encode-time (decode-time @dots{})) | 1132 (apply 'encode-time (decode-time @dots{})) |
1121 @end example | 1133 @end example |
1122 | 1134 |
1123 You can perform simple date arithmetic by using out-of-range values for | 1135 You can perform simple date arithmetic by using out-of-range values for |
1124 the @var{sec}, @var{minute}, @var{hour}, @var{day}, and @var{month} | 1136 the @var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month} |
1125 arguments; for example, day 0 means the day preceding the given month. | 1137 arguments; for example, day 0 means the day preceding the given month. |
1126 | 1138 |
1127 The operating system puts limits on the range of possible time values; | 1139 The operating system puts limits on the range of possible time values; |
1128 if you try to encode a time that is out of range, an error results. | 1140 if you try to encode a time that is out of range, an error results. |
1129 @end defun | 1141 @end defun |
1173 denotes 65 seconds from now. | 1185 denotes 65 seconds from now. |
1174 @item 1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 year | 1186 @item 1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 year |
1175 denotes exactly 103 months, 123 days, and 10862 seconds from now. | 1187 denotes exactly 103 months, 123 days, and 10862 seconds from now. |
1176 @end table | 1188 @end table |
1177 | 1189 |
1190 For relative time values, Emacs considers a month to be exactly thirty | |
1191 days, and a year to be exactly 365.25 days. | |
1192 | |
1178 If @var{time} is a number (integer or floating point), that specifies a | 1193 If @var{time} is a number (integer or floating point), that specifies a |
1179 relative time measured in seconds. | 1194 relative time measured in seconds. |
1180 | 1195 |
1181 The argument @var{repeat} specifies how often to repeat the call. If | 1196 The argument @var{repeat} specifies how often to repeat the call. If |
1182 @var{repeat} is @code{nil}, there are no repetitions; @var{function} is | 1197 @var{repeat} is @code{nil}, there are no repetitions; @var{function} is |
1234 | 1249 |
1235 @cindex idleness | 1250 @cindex idleness |
1236 Emacs becomes ``idle'' when it starts waiting for user input, and it | 1251 Emacs becomes ``idle'' when it starts waiting for user input, and it |
1237 remains idle until the user provides some input. If a timer is set for | 1252 remains idle until the user provides some input. If a timer is set for |
1238 five seconds of idleness, it runs approximately five seconds after Emacs | 1253 five seconds of idleness, it runs approximately five seconds after Emacs |
1239 first became idle. Even if its @var{repeat} is true, this timer will | 1254 first becomes idle. Even if @var{repeat} is non-@code{nil}, this timer |
1240 not run again as long as Emacs remains idle, because the duration of | 1255 will not run again as long as Emacs remains idle, because the duration |
1241 idleness will continue to increase and will not go down to five seconds | 1256 of idleness will continue to increase and will not go down to five |
1242 again. | 1257 seconds again. |
1243 | 1258 |
1244 Emacs can do various things while idle: garbage collect, autosave or | 1259 Emacs can do various things while idle: garbage collect, autosave or |
1245 handle data from a subprocess. But these interludes during idleness do | 1260 handle data from a subprocess. But these interludes during idleness do |
1246 not interfere with idle timers, because they do not reset the clock of | 1261 not interfere with idle timers, because they do not reset the clock of |
1247 idleness to zero. An idle timer set for 600 seconds will run when ten | 1262 idleness to zero. An idle timer set for 600 seconds will run when ten |
1248 minutes have elapsed since the last user command was finished, even if | 1263 minutes have elapsed since the last user command was finished, even if |
1249 subprocess output has been accepted thousands of times within those ten | 1264 subprocess output has been accepted thousands of times within those ten |
1250 minutes, even if there have been garbage collections and autosaves. | 1265 minutes, and even if there have been garbage collections and autosaves. |
1251 | 1266 |
1252 When the user supplies input, Emacs becomes non-idle while executing the | 1267 When the user supplies input, Emacs becomes non-idle while executing the |
1253 input. Then it becomes idle again, and all the idle timers that are | 1268 input. Then it becomes idle again, and all the idle timers that are |
1254 set up to repeat will subsequently run another time, one by one. | 1269 set up to repeat will subsequently run another time, one by one. |
1255 | 1270 |
1282 | 1297 |
1283 @defun set-input-mode interrupt flow meta quit-char | 1298 @defun set-input-mode interrupt flow meta quit-char |
1284 This function sets the mode for reading keyboard input. If | 1299 This function sets the mode for reading keyboard input. If |
1285 @var{interrupt} is non-null, then Emacs uses input interrupts. If it is | 1300 @var{interrupt} is non-null, then Emacs uses input interrupts. If it is |
1286 @code{nil}, then it uses @sc{cbreak} mode. The default setting is | 1301 @code{nil}, then it uses @sc{cbreak} mode. The default setting is |
1287 system dependent. Some systems always use @sc{cbreak} mode regardless | 1302 system-dependent. Some systems always use @sc{cbreak} mode regardless |
1288 of what is specified. | 1303 of what is specified. |
1289 | 1304 |
1290 When Emacs communicates directly with X, it ignores this argument and | 1305 When Emacs communicates directly with X, it ignores this argument and |
1291 uses interrupts if that is the way it knows how to communicate. | 1306 uses interrupts if that is the way it knows how to communicate. |
1292 | 1307 |
1312 The @code{current-input-mode} function returns the input mode settings | 1327 The @code{current-input-mode} function returns the input mode settings |
1313 Emacs is currently using. | 1328 Emacs is currently using. |
1314 | 1329 |
1315 @c Emacs 19 feature | 1330 @c Emacs 19 feature |
1316 @defun current-input-mode | 1331 @defun current-input-mode |
1317 This function returns current mode for reading keyboard input. It | 1332 This function returns the current mode for reading keyboard input. It |
1318 returns a list, corresponding to the arguments of @code{set-input-mode}, | 1333 returns a list, corresponding to the arguments of @code{set-input-mode}, |
1319 of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in | 1334 of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in |
1320 which: | 1335 which: |
1321 @table @var | 1336 @table @var |
1322 @item interrupt | 1337 @item interrupt |
1377 @defvar keyboard-translate-table | 1392 @defvar keyboard-translate-table |
1378 This variable is the translate table for keyboard characters. It lets | 1393 This variable is the translate table for keyboard characters. It lets |
1379 you reshuffle the keys on the keyboard without changing any command | 1394 you reshuffle the keys on the keyboard without changing any command |
1380 bindings. Its value is normally a char-table, or else @code{nil}. | 1395 bindings. Its value is normally a char-table, or else @code{nil}. |
1381 | 1396 |
1382 If @code{keyboard-translate-table} is a char-table, then each character | 1397 If @code{keyboard-translate-table} is a char-table |
1383 read from the keyboard is looked up in this character. If the value | 1398 (@pxref{Char-Tables}), then each character read from the keyboard is |
1384 found there is non-@code{nil}, then it is used instead of the | 1399 looked up in this char-table. If the value found there is |
1385 actual input character. | 1400 non-@code{nil}, then it is used instead of the actual input character. |
1386 | 1401 |
1387 In the example below, we set @code{keyboard-translate-table} to a | 1402 In the example below, we set @code{keyboard-translate-table} to a |
1388 char-table. Then we fill it in to swap the characters @kbd{C-s} and | 1403 char-table. Then we fill it in to swap the characters @kbd{C-s} and |
1389 @kbd{C-\} and the characters @kbd{C-q} and @kbd{C-^}. Subsequently, | 1404 @kbd{C-\} and the characters @kbd{C-q} and @kbd{C-^}. Subsequently, |
1390 typing @kbd{C-\} has all the usual effects of typing @kbd{C-s}, and vice | 1405 typing @kbd{C-\} has all the usual effects of typing @kbd{C-s}, and vice |
1571 | 1586 |
1572 @node Terminal Output | 1587 @node Terminal Output |
1573 @section Terminal Output | 1588 @section Terminal Output |
1574 @cindex terminal output | 1589 @cindex terminal output |
1575 | 1590 |
1576 The terminal output functions send output to the terminal or keep | 1591 The terminal output functions send output to the terminal, or keep |
1577 track of output sent to the terminal. The variable @code{baud-rate} | 1592 track of output sent to the terminal. The variable @code{baud-rate} |
1578 tells you what Emacs thinks is the output speed of the terminal. | 1593 tells you what Emacs thinks is the output speed of the terminal. |
1579 | 1594 |
1580 @defvar baud-rate | 1595 @defvar baud-rate |
1581 This variable's value is the output speed of the terminal, as far as | 1596 This variable's value is the output speed of the terminal, as far as |
1605 @defun send-string-to-terminal string | 1620 @defun send-string-to-terminal string |
1606 This function sends @var{string} to the terminal without alteration. | 1621 This function sends @var{string} to the terminal without alteration. |
1607 Control characters in @var{string} have terminal-dependent effects. | 1622 Control characters in @var{string} have terminal-dependent effects. |
1608 | 1623 |
1609 One use of this function is to define function keys on terminals that | 1624 One use of this function is to define function keys on terminals that |
1610 have downloadable function key definitions. For example, this is how on | 1625 have downloadable function key definitions. For example, this is how (on |
1611 certain terminals to define function key 4 to move forward four | 1626 certain terminals) to define function key 4 to move forward four |
1612 characters (by transmitting the characters @kbd{C-u C-f} to the | 1627 characters (by transmitting the characters @kbd{C-u C-f} to the |
1613 computer): | 1628 computer): |
1614 | 1629 |
1615 @example | 1630 @example |
1616 @group | 1631 @group |
1639 @result{} nil | 1654 @result{} nil |
1640 @end group | 1655 @end group |
1641 @end example | 1656 @end example |
1642 @end deffn | 1657 @end deffn |
1643 | 1658 |
1659 @node Sound Output | |
1660 @section Sound Output | |
1661 @cindex sound | |
1662 | |
1663 To play sound using Emacs, use the function @code{play-sound}. Only | |
1664 certain systems are supported; if you call @code{play-sound} on a system | |
1665 which cannot really do the job, it gives an error. Emacs version 20 and | |
1666 earlier did not support sound at all. | |
1667 | |
1668 The sound must be stored as a file in RIFF-WAVE format (@samp{.wav}) | |
1669 or Sun Audio format (@samp{.au}). | |
1670 | |
1671 @tindex play-sound | |
1672 @defun play-sound sound | |
1673 This function plays a specified sound. The argument, @var{sound}, has | |
1674 the form @code{(sound @var{properties}...)}, where the @var{properties} | |
1675 consist of alternating keywords (particular symbols recognized | |
1676 specially) and values corresponding to them. | |
1677 | |
1678 Here is a table of the keywords that are currently meaningful in | |
1679 @var{sound}, and their meanings: | |
1680 | |
1681 @table @code | |
1682 @item :file @var{file} | |
1683 This specifies the file containing the sound to play. | |
1684 If the file name is not absolute, it is expanded against | |
1685 the directory @code{data-directory}. | |
1686 | |
1687 @item :volume @var{volume} | |
1688 This specifies how loud to play the sound. It should be a number in the | |
1689 range of 0 to 1. The default is to use whatever volume has been | |
1690 specified before. | |
1691 @end table | |
1692 | |
1693 Before actually playing the sound, @code{play-sound} | |
1694 calls the functions in the list @code{play-sound-functions}. | |
1695 Each function is called with one argument, @var{sound}. | |
1696 @end defun | |
1697 | |
1698 @tindex play-sound-functions | |
1699 @defvar play-sound-functions | |
1700 A list of functions to be called before playing a sound. Each function | |
1701 is called with one argument, a property list that describes the sound. | |
1702 @end defvar | |
1703 | |
1644 @node Special Keysyms | 1704 @node Special Keysyms |
1645 @section System-Specific X11 Keysyms | 1705 @section System-Specific X11 Keysyms |
1646 | 1706 |
1647 To define system-specific X11 keysyms, set the variable | 1707 To define system-specific X11 keysyms, set the variable |
1648 @code{system-key-alist}. | 1708 @code{system-key-alist}. |
1649 | 1709 |
1650 @defvar system-key-alist | 1710 @defvar system-key-alist |
1651 This variable's value should be an alist with one element for each | 1711 This variable's value should be an alist with one element for each |
1652 system-specific keysym. An element has this form: @code{(@var{code} | 1712 system-specific keysym. Each element has the form @code{(@var{code} |
1653 . @var{symbol})}, where @var{code} is the numeric keysym code (not | 1713 . @var{symbol})}, where @var{code} is the numeric keysym code (not |
1654 including the ``vendor specific'' bit, | 1714 including the ``vendor specific'' bit, |
1655 @ifinfo | 1715 @ifinfo |
1656 -2**28), | 1716 -2**28), |
1657 @end ifinfo | 1717 @end ifinfo |
1658 @tex | 1718 @tex |
1659 $-2^{28}$), | 1719 $-2^{28}$), |
1660 @end tex | 1720 @end tex |
1661 and @var{symbol} is the name for the function key. | 1721 and @var{symbol} is the name for the function key. |
1662 | 1722 |
1663 For example @code{(168 . mute-acute)} defines a system-specific key used | 1723 For example @code{(168 . mute-acute)} defines a system-specific key (used |
1664 by HP X servers whose numeric code is | 1724 by HP X servers) whose numeric code is |
1665 @ifinfo | 1725 @ifinfo |
1666 -2**28 | 1726 -2**28 |
1667 @end ifinfo | 1727 @end ifinfo |
1668 @tex | 1728 @tex |
1669 $-2^{28}$ | 1729 $-2^{28}$ |
1692 @cindex @kbd{C-q} | 1752 @cindex @kbd{C-q} |
1693 At one time, most terminals did not need flow control, and none used | 1753 At one time, most terminals did not need flow control, and none used |
1694 @code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of | 1754 @code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of |
1695 @kbd{C-s} and @kbd{C-q} as command characters for searching and quoting | 1755 @kbd{C-s} and @kbd{C-q} as command characters for searching and quoting |
1696 was natural and uncontroversial. With so many commands needing key | 1756 was natural and uncontroversial. With so many commands needing key |
1697 assignments, of course we assigned meanings to nearly all @sc{ASCII} | 1757 assignments, of course we assigned meanings to nearly all @sc{ascii} |
1698 control characters. | 1758 control characters. |
1699 | 1759 |
1700 Later, some terminals were introduced which required these characters | 1760 Later, some terminals were introduced which required these characters |
1701 for flow control. They were not very good terminals for full-screen | 1761 for flow control. They were not very good terminals for full-screen |
1702 editing, so Emacs maintainers ignored them. In later years, flow | 1762 editing, so Emacs maintainers ignored them. In later years, flow |
1767 @node Batch Mode | 1827 @node Batch Mode |
1768 @section Batch Mode | 1828 @section Batch Mode |
1769 @cindex batch mode | 1829 @cindex batch mode |
1770 @cindex noninteractive use | 1830 @cindex noninteractive use |
1771 | 1831 |
1772 The command line option @samp{-batch} causes Emacs to run | 1832 The command-line option @samp{-batch} causes Emacs to run |
1773 noninteractively. In this mode, Emacs does not read commands from the | 1833 noninteractively. In this mode, Emacs does not read commands from the |
1774 terminal, it does not alter the terminal modes, and it does not expect | 1834 terminal, it does not alter the terminal modes, and it does not expect |
1775 to be outputting to an erasable screen. The idea is that you specify | 1835 to be outputting to an erasable screen. The idea is that you specify |
1776 Lisp programs to run; when they are finished, Emacs should exit. The | 1836 Lisp programs to run; when they are finished, Emacs should exit. The |
1777 way to specify the programs to run is with @samp{-l @var{file}}, which | 1837 way to specify the programs to run is with @samp{-l @var{file}}, which |
1778 loads the library named @var{file}, and @samp{-f @var{function}}, which | 1838 loads the library named @var{file}, and @samp{-f @var{function}}, which |
1779 calls @var{function} with no arguments. | 1839 calls @var{function} with no arguments. |
1780 | 1840 |
1781 Any Lisp program output that would normally go to the echo area, | 1841 Any Lisp program output that would normally go to the echo area, |
1782 either using @code{message} or using @code{prin1}, etc., with @code{t} | 1842 either using @code{message}, or using @code{prin1}, etc., with @code{t} |
1783 as the stream, goes instead to Emacs's standard error descriptor when | 1843 as the stream, goes instead to Emacs's standard error descriptor when |
1784 in batch mode. Thus, Emacs behaves much like a noninteractive | 1844 in batch mode. Thus, Emacs behaves much like a noninteractive |
1785 application program. (The echo area output that Emacs itself normally | 1845 application program. (The echo area output that Emacs itself normally |
1786 generates, such as command echoing, is suppressed entirely.) | 1846 generates, such as command echoing, is suppressed entirely.) |
1787 | 1847 |