(M21670): Unify GB, CNS and JIS.
[chise/xemacs-chise.git-] / info / lispref.info-39
1 This is ../info/lispref.info, produced by makeinfo version 4.0 from
2 lispref/lispref.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * Lispref: (lispref).           XEmacs Lisp Reference Manual.
7 END-INFO-DIR-ENTRY
8
9    Edition History:
10
11    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
12 Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
13 Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
14 XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
15 GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
16 Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
17 Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
18 Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May,
19 November 1997 XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
20
21    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
22 Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
23 Copyright (C) 1995, 1996 Ben Wing.
24
25    Permission is granted to make and distribute verbatim copies of this
26 manual provided the copyright notice and this permission notice are
27 preserved on all copies.
28
29    Permission is granted to copy and distribute modified versions of
30 this manual under the conditions for verbatim copying, provided that the
31 entire resulting derived work is distributed under the terms of a
32 permission notice identical to this one.
33
34    Permission is granted to copy and distribute translations of this
35 manual into another language, under the above conditions for modified
36 versions, except that this permission notice may be stated in a
37 translation approved by the Foundation.
38
39    Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided also
41 that the section entitled "GNU General Public License" is included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
45
46    Permission is granted to copy and distribute translations of this
47 manual into another language, under the above conditions for modified
48 versions, except that the section entitled "GNU General Public License"
49 may be included in a translation approved by the Free Software
50 Foundation instead of in the original English.
51
52 \1f
53 File: lispref.info,  Node: System Interface,  Next: X-Windows,  Prev: Processes,  Up: Top
54
55 Operating System Interface
56 **************************
57
58    This chapter is about starting and getting out of Emacs, access to
59 values in the operating system environment, and terminal input, output,
60 and flow control.
61
62    *Note Building XEmacs::, for related information.  See also *Note
63 Display::, for additional operating system status information
64 pertaining to the terminal and the screen.
65
66 * Menu:
67
68 * Starting Up::         Customizing XEmacs start-up processing.
69 * Getting Out::         How exiting works (permanent or temporary).
70 * System Environment::  Distinguish the name and kind of system.
71 * User Identification:: Finding the name and user id of the user.
72 * Time of Day::         Getting the current time.
73 * Time Conversion::     Converting a time from numeric form to a string, or
74                           to calendrical data (or vice versa).
75 * Timers::              Setting a timer to call a function at a certain time.
76 * Terminal Input::      Recording terminal input for debugging.
77 * Terminal Output::     Recording terminal output for debugging.
78 * Flow Control::        How to turn output flow control on or off.
79 * Batch Mode::          Running XEmacs without terminal interaction.
80
81 \1f
82 File: lispref.info,  Node: Starting Up,  Next: Getting Out,  Up: System Interface
83
84 Starting Up XEmacs
85 ==================
86
87    This section describes what XEmacs does when it is started, and how
88 you can customize these actions.
89
90 * Menu:
91
92 * Start-up Summary::        Sequence of actions XEmacs performs at start-up.
93 * Init File::               Details on reading the init file (`.emacs').
94 * Terminal-Specific::       How the terminal-specific Lisp file is read.
95 * Command Line Arguments::  How command line arguments are processed,
96                               and how you can customize them.
97
98 \1f
99 File: lispref.info,  Node: Start-up Summary,  Next: Init File,  Up: Starting Up
100
101 Summary: Sequence of Actions at Start Up
102 ----------------------------------------
103
104    The order of operations performed (in `startup.el') by XEmacs when
105 it is started up is as follows:
106
107   1. It loads the initialization library for the window system, if you
108      are using a window system.  This library's name is
109      `term/WINDOWSYSTEM-win.el'.
110
111   2. It processes the initial options.  (Some of them are handled even
112      earlier than this.)
113
114   3. It initializes the X window frame and faces, if appropriate.
115
116   4. It runs the normal hook `before-init-hook'.
117
118   5. It loads the library `site-start', unless the option
119      `-no-site-file' was specified.  The library's file name is usually
120      `site-start.el'.
121
122   6. It loads the file `~/.emacs' unless `-q' was specified on the
123      command line.  (This is not done in `-batch' mode.)  The `-u'
124      option can specify the user name whose home directory should be
125      used instead of `~'.
126
127   7. It loads the library `default' unless `inhibit-default-init' is
128      non-`nil'.  (This is not done in `-batch' mode or if `-q' was
129      specified on the command line.)  The library's file name is
130      usually `default.el'.
131
132   8. It runs the normal hook `after-init-hook'.
133
134   9. It sets the major mode according to `initial-major-mode', provided
135      the buffer `*scratch*' is still current and still in Fundamental
136      mode.
137
138  10. It loads the terminal-specific Lisp file, if any, except when in
139      batch mode or using a window system.
140
141  11. It displays the initial echo area message, unless you have
142      suppressed that with `inhibit-startup-echo-area-message'.
143
144  12. It processes the action arguments from the command line.
145
146  13. It runs `term-setup-hook'.
147
148  14. It calls `frame-notice-user-settings', which modifies the
149      parameters of the selected frame according to whatever the init
150      files specify.
151
152  15. It runs `window-setup-hook'.  *Note Terminal-Specific::.
153
154  16. It displays copyleft, nonwarranty, and basic use information,
155      provided there were no remaining command line arguments (a few
156      steps above) and the value of `inhibit-startup-message' is `nil'.
157
158  - User Option: inhibit-startup-message
159      This variable inhibits the initial startup messages (the
160      nonwarranty, etc.).  If it is non-`nil', then the messages are not
161      printed.
162
163      This variable exists so you can set it in your personal init file,
164      once you are familiar with the contents of the startup message.
165      Do not set this variable in the init file of a new user, or in a
166      way that affects more than one user, because that would prevent
167      new users from receiving the information they are supposed to see.
168
169  - User Option: inhibit-startup-echo-area-message
170      This variable controls the display of the startup echo area
171      message.  You can suppress the startup echo area message by adding
172      text with this form to your `.emacs' file:
173
174           (setq inhibit-startup-echo-area-message
175                 "YOUR-LOGIN-NAME")
176
177      Simply setting `inhibit-startup-echo-area-message' to your login
178      name is not sufficient to inhibit the message; Emacs explicitly
179      checks whether `.emacs' contains an expression as shown above.
180      Your login name must appear in the expression as a Lisp string
181      constant.
182
183      This way, you can easily inhibit the message for yourself if you
184      wish, but thoughtless copying of your `.emacs' file will not
185      inhibit the message for someone else.
186
187 \1f
188 File: lispref.info,  Node: Init File,  Next: Terminal-Specific,  Prev: Start-up Summary,  Up: Starting Up
189
190 The Init File: `.emacs'
191 -----------------------
192
193    When you start XEmacs, it normally attempts to load the file
194 `.emacs' from your home directory.  This file, if it exists, must
195 contain Lisp code.  It is called your "init file".  The command line
196 switches `-q' and `-u' affect the use of the init file; `-q' says not
197 to load an init file, and `-u' says to load a specified user's init
198 file instead of yours.  *Note Entering XEmacs: (xemacs)Entering XEmacs.
199
200    A site may have a "default init file", which is the library named
201 `default.el'.  XEmacs finds the `default.el' file through the standard
202 search path for libraries (*note How Programs Do Loading::).  The
203 XEmacs distribution does not come with this file; sites may provide one
204 for local customizations.  If the default init file exists, it is
205 loaded whenever you start Emacs, except in batch mode or if `-q' is
206 specified.  But your own personal init file, if any, is loaded first; if
207 it sets `inhibit-default-init' to a non-`nil' value, then XEmacs does
208 not subsequently load the `default.el' file.
209
210    Another file for site-customization is `site-start.el'.  Emacs loads
211 this _before_ the user's init file.  You can inhibit the loading of
212 this file with the option `-no-site-file'.
213
214  - Variable: site-run-file
215      This variable specifies the site-customization file to load before
216      the user's init file.  Its normal value is `"site-start"'.
217
218    If there is a great deal of code in your `.emacs' file, you should
219 move it into another file named `SOMETHING.el', byte-compile it (*note
220 Byte Compilation::), and make your `.emacs' file load the other file
221 using `load' (*note Loading::).
222
223    *Note Init File Examples: (xemacs)Init File Examples, for examples
224 of how to make various commonly desired customizations in your `.emacs'
225 file.
226
227  - User Option: inhibit-default-init
228      This variable prevents XEmacs from loading the default
229      initialization library file for your session of XEmacs.  If its
230      value is non-`nil', then the default library is not loaded.  The
231      default value is `nil'.
232
233  - Variable: before-init-hook
234  - Variable: after-init-hook
235      These two normal hooks are run just before, and just after,
236      loading of the user's init file, `default.el', and/or
237      `site-start.el'.
238
239 \1f
240 File: lispref.info,  Node: Terminal-Specific,  Next: Command Line Arguments,  Prev: Init File,  Up: Starting Up
241
242 Terminal-Specific Initialization
243 --------------------------------
244
245    Each terminal type can have its own Lisp library that XEmacs loads
246 when run on that type of terminal.  For a terminal type named TERMTYPE,
247 the library is called `term/TERMTYPE'.  XEmacs finds the file by
248 searching the `load-path' directories as it does for other files, and
249 trying the `.elc' and `.el' suffixes.  Normally, terminal-specific Lisp
250 library is located in `emacs/lisp/term', a subdirectory of the
251 `emacs/lisp' directory in which most XEmacs Lisp libraries are kept.
252
253    The library's name is constructed by concatenating the value of the
254 variable `term-file-prefix' and the terminal type.  Normally,
255 `term-file-prefix' has the value `"term/"'; changing this is not
256 recommended.
257
258    The usual function of a terminal-specific library is to enable
259 special keys to send sequences that XEmacs can recognize.  It may also
260 need to set or add to `function-key-map' if the Termcap entry does not
261 specify all the terminal's function keys.  *Note Terminal Input::.
262
263    When the name of the terminal type contains a hyphen, only the part
264 of the name before the first hyphen is significant in choosing the
265 library name.  Thus, terminal types `aaa-48' and `aaa-30-rv' both use
266 the `term/aaa' library.  If necessary, the library can evaluate
267 `(getenv "TERM")' to find the full name of the terminal type.
268
269    Your `.emacs' file can prevent the loading of the terminal-specific
270 library by setting the variable `term-file-prefix' to `nil'.  This
271 feature is useful when experimenting with your own peculiar
272 customizations.
273
274    You can also arrange to override some of the actions of the
275 terminal-specific library by setting the variable `term-setup-hook'.
276 This is a normal hook which XEmacs runs using `run-hooks' at the end of
277 XEmacs initialization, after loading both your `.emacs' file and any
278 terminal-specific libraries.  You can use this variable to define
279 initializations for terminals that do not have their own libraries.
280 *Note Hooks::.
281
282  - Variable: term-file-prefix
283      If the `term-file-prefix' variable is non-`nil', XEmacs loads a
284      terminal-specific initialization file as follows:
285
286           (load (concat term-file-prefix (getenv "TERM")))
287
288      You may set the `term-file-prefix' variable to `nil' in your
289      `.emacs' file if you do not wish to load the
290      terminal-initialization file.  To do this, put the following in
291      your `.emacs' file: `(setq term-file-prefix nil)'.
292
293  - Variable: term-setup-hook
294      This variable is a normal hook that XEmacs runs after loading your
295      `.emacs' file, the default initialization file (if any) and the
296      terminal-specific Lisp file.
297
298      You can use `term-setup-hook' to override the definitions made by a
299      terminal-specific file.
300
301  - Variable: window-setup-hook
302      This variable is a normal hook which XEmacs runs after loading your
303      `.emacs' file and the default initialization file (if any), after
304      loading terminal-specific Lisp code, and after running the hook
305      `term-setup-hook'.
306
307 \1f
308 File: lispref.info,  Node: Command Line Arguments,  Prev: Terminal-Specific,  Up: Starting Up
309
310 Command Line Arguments
311 ----------------------
312
313    You can use command line arguments to request various actions when
314 you start XEmacs.  Since you do not need to start XEmacs more than once
315 per day, and will often leave your XEmacs session running longer than
316 that, command line arguments are hardly ever used.  As a practical
317 matter, it is best to avoid making the habit of using them, since this
318 habit would encourage you to kill and restart XEmacs unnecessarily
319 often.  These options exist for two reasons: to be compatible with
320 other editors (for invocation by other programs) and to enable shell
321 scripts to run specific Lisp programs.
322
323    This section describes how Emacs processes command line arguments,
324 and how you can customize them.
325
326  - Function: command-line
327      This function parses the command line that XEmacs was called with,
328      processes it, loads the user's `.emacs' file and displays the
329      startup messages.
330
331  - Variable: command-line-processed
332      The value of this variable is `t' once the command line has been
333      processed.
334
335      If you redump XEmacs by calling `dump-emacs', you may wish to set
336      this variable to `nil' first in order to cause the new dumped
337      XEmacs to process its new command line arguments.
338
339  - Variable: command-switch-alist
340      The value of this variable is an alist of user-defined command-line
341      options and associated handler functions.  This variable exists so
342      you can add elements to it.
343
344      A "command line option" is an argument on the command line of the
345      form:
346
347           -OPTION
348
349      The elements of the `command-switch-alist' look like this:
350
351           (OPTION . HANDLER-FUNCTION)
352
353      The HANDLER-FUNCTION is called to handle OPTION and receives the
354      option name as its sole argument.
355
356      In some cases, the option is followed in the command line by an
357      argument.  In these cases, the HANDLER-FUNCTION can find all the
358      remaining command-line arguments in the variable
359      `command-line-args-left'.  (The entire list of command-line
360      arguments is in `command-line-args'.)
361
362      The command line arguments are parsed by the `command-line-1'
363      function in the `startup.el' file.  See also *Note Command Line
364      Switches and Arguments: (xemacs)Command Switches.
365
366  - Variable: command-line-args
367      The value of this variable is the list of command line arguments
368      passed to XEmacs.
369
370  - Variable: command-line-functions
371      This variable's value is a list of functions for handling an
372      unrecognized command-line argument.  Each time the next argument
373      to be processed has no special meaning, the functions in this list
374      are called, in order of appearance, until one of them returns a
375      non-`nil' value.
376
377      These functions are called with no arguments.  They can access the
378      command-line argument under consideration through the variable
379      `argi'.  The remaining arguments (not including the current one)
380      are in the variable `command-line-args-left'.
381
382      When a function recognizes and processes the argument in `argi', it
383      should return a non-`nil' value to say it has dealt with that
384      argument.  If it has also dealt with some of the following
385      arguments, it can indicate that by deleting them from
386      `command-line-args-left'.
387
388      If all of these functions return `nil', then the argument is used
389      as a file name to visit.
390
391 \1f
392 File: lispref.info,  Node: Getting Out,  Next: System Environment,  Prev: Starting Up,  Up: System Interface
393
394 Getting out of XEmacs
395 =====================
396
397    There are two ways to get out of XEmacs: you can kill the XEmacs job,
398 which exits permanently, or you can suspend it, which permits you to
399 reenter the XEmacs process later.  As a practical matter, you seldom
400 kill XEmacs--only when you are about to log out.  Suspending is much
401 more common.
402
403 * Menu:
404
405 * Killing XEmacs::        Exiting XEmacs irreversibly.
406 * Suspending XEmacs::     Exiting XEmacs reversibly.
407
408 \1f
409 File: lispref.info,  Node: Killing XEmacs,  Next: Suspending XEmacs,  Up: Getting Out
410
411 Killing XEmacs
412 --------------
413
414    Killing XEmacs means ending the execution of the XEmacs process.  The
415 parent process normally resumes control.  The low-level primitive for
416 killing XEmacs is `kill-emacs'.
417
418  - Function: kill-emacs &optional exit-data
419      This function exits the XEmacs process and kills it.
420
421      If EXIT-DATA is an integer, then it is used as the exit status of
422      the XEmacs process.  (This is useful primarily in batch operation;
423      see *Note Batch Mode::.)
424
425      If EXIT-DATA is a string, its contents are stuffed into the
426      terminal input buffer so that the shell (or whatever program next
427      reads input) can read them.
428
429    All the information in the XEmacs process, aside from files that have
430 been saved, is lost when the XEmacs is killed.  Because killing XEmacs
431 inadvertently can lose a lot of work, XEmacs queries for confirmation
432 before actually terminating if you have buffers that need saving or
433 subprocesses that are running.  This is done in the function
434 `save-buffers-kill-emacs'.
435
436  - Variable: kill-emacs-query-functions
437      After asking the standard questions, `save-buffers-kill-emacs'
438      calls the functions in the list `kill-buffer-query-functions', in
439      order of appearance, with no arguments.  These functions can ask
440      for additional confirmation from the user.  If any of them returns
441      non-`nil', XEmacs is not killed.
442
443  - Variable: kill-emacs-hook
444      This variable is a normal hook; once `save-buffers-kill-emacs' is
445      finished with all file saving and confirmation, it runs the
446      functions in this hook.
447
448 \1f
449 File: lispref.info,  Node: Suspending XEmacs,  Prev: Killing XEmacs,  Up: Getting Out
450
451 Suspending XEmacs
452 -----------------
453
454    "Suspending XEmacs" means stopping XEmacs temporarily and returning
455 control to its superior process, which is usually the shell.  This
456 allows you to resume editing later in the same XEmacs process, with the
457 same buffers, the same kill ring, the same undo history, and so on.  To
458 resume XEmacs, use the appropriate command in the parent shell--most
459 likely `fg'.
460
461    Some operating systems do not support suspension of jobs; on these
462 systems, "suspension" actually creates a new shell temporarily as a
463 subprocess of XEmacs.  Then you would exit the shell to return to
464 XEmacs.
465
466    Suspension is not useful with window systems such as X, because the
467 XEmacs job may not have a parent that can resume it again, and in any
468 case you can give input to some other job such as a shell merely by
469 moving to a different window.  Therefore, suspending is not allowed
470 when XEmacs is an X client.
471
472  - Function: suspend-emacs string
473      This function stops XEmacs and returns control to the superior
474      process.  If and when the superior process resumes XEmacs,
475      `suspend-emacs' returns `nil' to its caller in Lisp.
476
477      If STRING is non-`nil', its characters are sent to be read as
478      terminal input by XEmacs's superior shell.  The characters in
479      STRING are not echoed by the superior shell; only the results
480      appear.
481
482      Before suspending, `suspend-emacs' runs the normal hook
483      `suspend-hook'.  In Emacs version 18, `suspend-hook' was not a
484      normal hook; its value was a single function, and if its value was
485      non-`nil', then `suspend-emacs' returned immediately without
486      actually suspending anything.
487
488      After the user resumes XEmacs, `suspend-emacs' runs the normal hook
489      `suspend-resume-hook'.  *Note Hooks::.
490
491      The next redisplay after resumption will redraw the entire screen,
492      unless the variable `no-redraw-on-reenter' is non-`nil' (*note
493      Refresh Screen::).
494
495      In the following example, note that `pwd' is not echoed after
496      XEmacs is suspended.  But it is read and executed by the shell.
497
498           (suspend-emacs)
499                => nil
500           
501           (add-hook 'suspend-hook
502                     (function (lambda ()
503                                 (or (y-or-n-p
504                                       "Really suspend? ")
505                                     (error "Suspend cancelled")))))
506                => (lambda nil
507                     (or (y-or-n-p "Really suspend? ")
508                         (error "Suspend cancelled")))
509           (add-hook 'suspend-resume-hook
510                     (function (lambda () (message "Resumed!"))))
511                => (lambda nil (message "Resumed!"))
512           (suspend-emacs "pwd")
513                => nil
514           ---------- Buffer: Minibuffer ----------
515           Really suspend? y
516           ---------- Buffer: Minibuffer ----------
517           
518           ---------- Parent Shell ----------
519           lewis@slug[23] % /user/lewis/manual
520           lewis@slug[24] % fg
521           
522           ---------- Echo Area ----------
523           Resumed!
524
525  - Variable: suspend-hook
526      This variable is a normal hook run before suspending.
527
528  - Variable: suspend-resume-hook
529      This variable is a normal hook run after suspending.
530
531 \1f
532 File: lispref.info,  Node: System Environment,  Next: User Identification,  Prev: Getting Out,  Up: System Interface
533
534 Operating System Environment
535 ============================
536
537    XEmacs provides access to variables in the operating system
538 environment through various functions.  These variables include the
539 name of the system, the user's UID, and so on.
540
541  - Variable: system-type
542      The value of this variable is a symbol indicating the type of
543      operating system XEmacs is operating on.  Here is a table of the
544      possible values:
545
546     `aix-v3'
547           AIX.
548
549     `berkeley-unix'
550           Berkeley BSD.
551
552     `dgux'
553           Data General DGUX operating system.
554
555     `gnu'
556           A GNU system using the GNU HURD and Mach.
557
558     `hpux'
559           Hewlett-Packard HPUX operating system.
560
561     `irix'
562           Silicon Graphics Irix system.
563
564     `linux'
565           A GNU system using the Linux kernel.
566
567     `ms-dos'
568           Microsoft MS-DOS "operating system."
569
570     `next-mach'
571           NeXT Mach-based system.
572
573     `rtu'
574           Masscomp RTU, UCB universe.
575
576     `unisoft-unix'
577           UniSoft UniPlus.
578
579     `usg-unix-v'
580           AT&T System V.
581
582     `vax-vms'
583           VAX VMS.
584
585     `windows-nt'
586           Microsoft windows NT.
587
588     `xenix'
589           SCO Xenix 386.
590
591      We do not wish to add new symbols to make finer distinctions
592      unless it is absolutely necessary!  In fact, we hope to eliminate
593      some of these alternatives in the future.  We recommend using
594      `system-configuration' to distinguish between different operating
595      systems.
596
597  - Variable: system-configuration
598      This variable holds the three-part configuration name for the
599      hardware/software configuration of your system, as a string.  The
600      convenient way to test parts of this string is with `string-match'.
601
602  - Function: system-name
603      This function returns the name of the machine you are running on.
604           (system-name)
605                => "prep.ai.mit.edu"
606
607    The symbol `system-name' is a variable as well as a function.  In
608 fact, the function returns whatever value the variable `system-name'
609 currently holds.  Thus, you can set the variable `system-name' in case
610 Emacs is confused about the name of your system.  The variable is also
611 useful for constructing frame titles (*note Frame Titles::).
612
613  - Variable: mail-host-address
614      If this variable is non-`nil', it is used instead of `system-name'
615      for purposes of generating email addresses.  For example, it is
616      used when constructing the default value of `user-mail-address'.
617      *Note User Identification::.  (Since this is done when XEmacs
618      starts up, the value actually used is the one saved when XEmacs
619      was dumped.  *Note Building XEmacs::.)
620
621  - Function: getenv var
622      This function returns the value of the environment variable VAR,
623      as a string.  Within XEmacs, the environment variable values are
624      kept in the Lisp variable `process-environment'.
625
626           (getenv "USER")
627                => "lewis"
628           
629           lewis@slug[10] % printenv
630           PATH=.:/user/lewis/bin:/usr/bin:/usr/local/bin
631           USER=lewis
632           TERM=ibmapa16
633           SHELL=/bin/csh
634           HOME=/user/lewis
635
636  - Command: setenv variable value
637      This command sets the value of the environment variable named
638      VARIABLE to VALUE.  Both arguments should be strings.  This
639      function works by modifying `process-environment'; binding that
640      variable with `let' is also reasonable practice.
641
642  - Variable: process-environment
643      This variable is a list of strings, each describing one environment
644      variable.  The functions `getenv' and `setenv' work by means of
645      this variable.
646
647           process-environment
648           => ("l=/usr/stanford/lib/gnuemacs/lisp"
649               "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
650               "USER=lewis"
651               "TERM=ibmapa16"
652               "SHELL=/bin/csh"
653               "HOME=/user/lewis")
654
655  - Variable: path-separator
656      This variable holds a string which says which character separates
657      directories in a search path (as found in an environment
658      variable).  Its value is `":"' for Unix and GNU systems, and `";"'
659      for MS-DOS and Windows NT.
660
661  - Variable: invocation-name
662      This variable holds the program name under which Emacs was
663      invoked.  The value is a string, and does not include a directory
664      name.
665
666  - Variable: invocation-directory
667      This variable holds the directory from which the Emacs executable
668      was invoked, or perhaps `nil' if that directory cannot be
669      determined.
670
671  - Variable: installation-directory
672      If non-`nil', this is a directory within which to look for the
673      `lib-src' and `etc' subdirectories.  This is non-`nil' when Emacs
674      can't find those directories in their standard installed
675      locations, but can find them in a directory related somehow to the
676      one containing the Emacs executable.
677
678  - Function: load-average &optional use-floats
679      This function returns a list of the current 1-minute, 5-minute and
680      15-minute load averages.  The values are integers that are 100
681      times the system load averages.  (The load averages indicate the
682      number of processes trying to run.)
683
684      When USE-FLOATS is non-`nil', floats will be returned instead of
685      integers.  These floats are not multiplied by 100.
686
687           (load-average)
688                => (169 158 164)
689           (load-average t)
690                => (1.69921875 1.58984375 1.640625)
691           
692           lewis@rocky[5] % uptime
693             8:06pm  up 16 day(s), 21:57,  40 users,
694            load average: 1.68, 1.59, 1.64
695
696      If the 5-minute or 15-minute load averages are not available,
697      return a shortened list, containing only those averages which are
698      available.
699
700      On some systems, this function may require special privileges to
701      run, or it may be unimplemented for the particular system type.
702      In that case, the function will signal an error.
703
704  - Function: emacs-pid
705      This function returns the process ID of the Emacs process.
706
707  - Function: setprv privilege-name &optional setp getprv
708      This function sets or resets a VMS privilege.  (It does not exist
709      on Unix.)  The first arg is the privilege name, as a string.  The
710      second argument, SETP, is `t' or `nil', indicating whether the
711      privilege is to be turned on or off.  Its default is `nil'.  The
712      function returns `t' if successful, `nil' otherwise.
713
714      If the third argument, GETPRV, is non-`nil', `setprv' does not
715      change the privilege, but returns `t' or `nil' indicating whether
716      the privilege is currently enabled.
717
718 \1f
719 File: lispref.info,  Node: User Identification,  Next: Time of Day,  Prev: System Environment,  Up: System Interface
720
721 User Identification
722 ===================
723
724  - Variable: user-mail-address
725      This holds the nominal email address of the user who is using
726      Emacs.  When Emacs starts up, it computes a default value that is
727      usually right, but users often set this themselves when the
728      default value is not right.
729
730  - Function: user-login-name &optional uid
731      If you don't specify UID, this function returns the name under
732      which the user is logged in.  If the environment variable `LOGNAME'
733      is set, that value is used.  Otherwise, if the environment variable
734      `USER' is set, that value is used.  Otherwise, the value is based
735      on the effective UID, not the real UID.
736
737      If you specify UID, the value is the user name that corresponds to
738      UID (which should be an integer).
739
740           (user-login-name)
741                => "lewis"
742
743  - Function: user-real-login-name
744      This function returns the user name corresponding to Emacs's real
745      UID.  This ignores the effective UID and ignores the environment
746      variables `LOGNAME' and `USER'.
747
748  - Variable: user-full-name
749      This variable holds the name of the user running this Emacs.  It is
750      initialized at startup time from the value of `NAME' environment
751      variable.  You can change the value of this variable to alter the
752      result of the `user-full-name' function.
753
754  - Function: user-full-name &optional user
755      This function returns the full name of USER.  If USER is `nil', it
756      defaults to the user running this Emacs.  In that case, the value
757      of `user-full-name' variable, if non-`nil', will be used.
758
759      If USER is specified explicitly, `user-full-name' variable is
760      ignored.
761
762           (user-full-name)
763                => "Hrvoje Niksic"
764           (setq user-full-name "Hrvoje \"Niksa\" Niksic")
765           (user-full-name)
766                => "Hrvoje \"Niksa\" Niksic"
767           (user-full-name "hniksic")
768                => "Hrvoje Niksic"
769
770    The symbols `user-login-name', `user-real-login-name' and
771 `user-full-name' are variables as well as functions.  The functions
772 return the same values that the variables hold.  These variables allow
773 you to "fake out" Emacs by telling the functions what to return.  The
774 variables are also useful for constructing frame titles (*note Frame
775 Titles::).
776
777  - Function: user-real-uid
778      This function returns the real UID of the user.
779
780           (user-real-uid)
781                => 19
782
783  - Function: user-uid
784      This function returns the effective UID of the user.
785
786  - Function: user-home-directory
787      This function returns the "`HOME'" directory of the user, and is
788      intended to replace occurrences of "`(getenv "HOME")'".  Under
789      Unix systems, the following is done:
790
791        1. Return the value of "`(getenv "HOME")'", if set.
792
793        2. Return "/", as a fallback, but issue a warning.  (Future
794           versions of XEmacs will also attempt to lookup the `HOME'
795           directory via `getpwent()', but this has not yet been
796           implemented.)
797
798      Under MS Windows, this is done:
799
800        1. Return the value of "`(getenv "HOME")'", if set.
801
802        2. If the environment variables `HOMEDRIVE' and `HOMEDIR' are
803           both set, return the concatenation (the following description
804           uses MS Windows environment variable substitution syntax):
805           `%HOMEDRIVE%%HOMEDIR%'.
806
807        3. Return "C:\", as a fallback, but issue a warning.
808
809 \1f
810 File: lispref.info,  Node: Time of Day,  Next: Time Conversion,  Prev: User Identification,  Up: System Interface
811
812 Time of Day
813 ===========
814
815    This section explains how to determine the current time and the time
816 zone.
817
818  - Function: current-time-string &optional time-value
819      This function returns the current time and date as a
820      humanly-readable string.  The format of the string is unvarying;
821      the number of characters used for each part is always the same, so
822      you can reliably use `substring' to extract pieces of it.  It is
823      wise to count the characters from the beginning of the string
824      rather than from the end, as additional information may be added
825      at the end.
826
827      The argument TIME-VALUE, if given, specifies a time to format
828      instead of the current time.  The argument should be a list whose
829      first two elements are integers.  Thus, you can use times obtained
830      from `current-time' (see below) and from `file-attributes' (*note
831      File Attributes::).
832
833           (current-time-string)
834                => "Wed Oct 14 22:21:05 1987"
835
836  - Function: current-time
837      This function returns the system's time value as a list of three
838      integers: `(HIGH LOW MICROSEC)'.  The integers HIGH and LOW
839      combine to give the number of seconds since 0:00 January 1, 1970,
840      which is HIGH * 2**16 + LOW.
841
842      The third element, MICROSEC, gives the microseconds since the
843      start of the current second (or 0 for systems that return time
844      only on the resolution of a second).
845
846      The first two elements can be compared with file time values such
847      as you get with the function `file-attributes'.  *Note File
848      Attributes::.
849
850  - Function: current-time-zone &optional time-value
851      This function returns a list describing the time zone that the
852      user is in.
853
854      The value has the form `(OFFSET NAME)'.  Here OFFSET is an integer
855      giving the number of seconds ahead of UTC (east of Greenwich).  A
856      negative value means west of Greenwich.  The second element, NAME
857      is a string giving the name of the time zone.  Both elements
858      change when daylight savings time begins or ends; if the user has
859      specified a time zone that does not use a seasonal time
860      adjustment, then the value is constant through time.
861
862      If the operating system doesn't supply all the information
863      necessary to compute the value, both elements of the list are
864      `nil'.
865
866      The argument TIME-VALUE, if given, specifies a time to analyze
867      instead of the current time.  The argument should be a cons cell
868      containing two integers, or a list whose first two elements are
869      integers.  Thus, you can use times obtained from `current-time'
870      (see above) and from `file-attributes' (*note File Attributes::).
871
872 \1f
873 File: lispref.info,  Node: Time Conversion,  Next: Timers,  Prev: Time of Day,  Up: System Interface
874
875 Time Conversion
876 ===============
877
878    These functions convert time values (lists of two or three integers)
879 to strings or to calendrical information.  There is also a function to
880 convert calendrical information to a time value.  You can get time
881 values from the functions `current-time' (*note Time of Day::) and
882 `file-attributes' (*note File Attributes::).
883
884  - Function: format-time-string format-string &optional time
885      This function converts TIME to a string according to
886      FORMAT-STRING.  If TIME is omitted, it defaults to the current
887      time.  The argument FORMAT-STRING may contain `%'-sequences which
888      say to substitute parts of the time.  Here is a table of what the
889      `%'-sequences mean:
890
891     `%a'
892           This stands for the abbreviated name of the day of week.
893
894     `%A'
895           This stands for the full name of the day of week.
896
897     `%b'
898           This stands for the abbreviated name of the month.
899
900     `%B'
901           This stands for the full name of the month.
902
903     `%c'
904           This is a synonym for `%x %X'.
905
906     `%C'
907           This has a locale-specific meaning.  In the default locale
908           (named C), it is equivalent to `%A, %B %e, %Y'.
909
910     `%d'
911           This stands for the day of month, zero-padded.
912
913     `%D'
914           This is a synonym for `%m/%d/%y'.
915
916     `%e'
917           This stands for the day of month, blank-padded.
918
919     `%h'
920           This is a synonym for `%b'.
921
922     `%H'
923           This stands for the hour (00-23).
924
925     `%I'
926           This stands for the hour (00-12).
927
928     `%j'
929           This stands for the day of the year (001-366).
930
931     `%k'
932           This stands for the hour (0-23), blank padded.
933
934     `%l'
935           This stands for the hour (1-12), blank padded.
936
937     `%m'
938           This stands for the month (01-12).
939
940     `%M'
941           This stands for the minute (00-59).
942
943     `%n'
944           This stands for a newline.
945
946     `%p'
947           This stands for `AM' or `PM', as appropriate.
948
949     `%r'
950           This is a synonym for `%I:%M:%S %p'.
951
952     `%R'
953           This is a synonym for `%H:%M'.
954
955     `%S'
956           This stands for the seconds (00-60).
957
958     `%t'
959           This stands for a tab character.
960
961     `%T'
962           This is a synonym for `%H:%M:%S'.
963
964     `%U'
965           This stands for the week of the year (01-52), assuming that
966           weeks start on Sunday.
967
968     `%w'
969           This stands for the numeric day of week (0-6).  Sunday is day
970           0.
971
972     `%W'
973           This stands for the week of the year (01-52), assuming that
974           weeks start on Monday.
975
976     `%x'
977           This has a locale-specific meaning.  In the default locale
978           (named C), it is equivalent to `%D'.
979
980     `%X'
981           This has a locale-specific meaning.  In the default locale
982           (named C), it is equivalent to `%T'.
983
984     `%y'
985           This stands for the year without century (00-99).
986
987     `%Y'
988           This stands for the year with century.
989
990     `%Z'
991           This stands for the time zone abbreviation.
992
993  - Function: decode-time time
994      This function converts a time value into calendrical information.
995      The return value is a list of nine elements, as follows:
996
997           (SECONDS MINUTES HOUR DAY MONTH YEAR DOW DST ZONE)
998
999      Here is what the elements mean:
1000
1001     SEC
1002           The number of seconds past the minute, as an integer between
1003           0 and 59.
1004
1005     MINUTE
1006           The number of minutes past the hour, as an integer between 0
1007           and 59.
1008
1009     HOUR
1010           The hour of the day, as an integer between 0 and 23.
1011
1012     DAY
1013           The day of the month, as an integer between 1 and 31.
1014
1015     MONTH
1016           The month of the year, as an integer between 1 and 12.
1017
1018     YEAR
1019           The year, an integer typically greater than 1900.
1020
1021     DOW
1022           The day of week, as an integer between 0 and 6, where 0
1023           stands for Sunday.
1024
1025     DST
1026           `t' if daylight savings time is effect, otherwise `nil'.
1027
1028     ZONE
1029           An integer indicating the time zone, as the number of seconds
1030           east of Greenwich.
1031
1032      Note that Common Lisp has different meanings for DOW and ZONE.
1033
1034  - Function: encode-time seconds minutes hour day month year &optional
1035           zone
1036      This function is the inverse of `decode-time'.  It converts seven
1037      items of calendrical data into a time value.  For the meanings of
1038      the arguments, see the table above under `decode-time'.
1039
1040      Year numbers less than 100 are treated just like other year
1041      numbers.  If you want them to stand for years above 1900, you must
1042      alter them yourself before you call `encode-time'.
1043
1044      The optional argument ZONE defaults to the current time zone and
1045      its daylight savings time rules.  If specified, it can be either a
1046      list (as you would get from `current-time-zone') or an integer (as
1047      you would get from `decode-time').  The specified zone is used
1048      without any further alteration for daylight savings time.
1049
1050 \1f
1051 File: lispref.info,  Node: Timers,  Next: Terminal Input,  Prev: Time Conversion,  Up: System Interface
1052
1053 Timers for Delayed Execution
1054 ============================
1055
1056    You can set up a timer to call a function at a specified future time.
1057
1058  - Function: add-timeout secs function object &optional resignal
1059      This function adds a timeout, to be signaled after the timeout
1060      period has elapsed.  SECS is a number of seconds, expressed as an
1061      integer or a float.  FUNCTION will be called after that many
1062      seconds have elapsed, with one argument, the given OBJECT.  If the
1063      optional RESIGNAL argument is provided, then after this timeout
1064      expires, `add-timeout' will automatically be called again with
1065      RESIGNAL as the first argument.
1066
1067      This function returns an object which is the "id" of this
1068      particular timeout.  You can pass that object to `disable-timeout'
1069      to turn off the timeout before it has been signalled.
1070
1071      The number of seconds may be expressed as a floating-point number,
1072      in which case some fractional part of a second will be used.
1073      Caveat: the usable timeout granularity will vary from system to
1074      system.
1075
1076      Adding a timeout causes a timeout event to be returned by
1077      `next-event', and the function will be invoked by
1078      `dispatch-event', so if XEmacs is in a tight loop, the function
1079      will not be invoked until the next call to sit-for or until the
1080      return to top-level (the same is true of process filters).
1081
1082      WARNING: if you are thinking of calling add-timeout from inside of
1083      a callback function as a way of resignalling a timeout, think
1084      again.  There is a race condition.  That's why the RESIGNAL
1085      argument exists.
1086
1087      (NOTE: In FSF Emacs, this function is called `run-at-time' and has
1088      different semantics.)
1089
1090  - Function: disable-timeout id
1091      Cancel the requested action for ID, which should be a value
1092      previously returned by `add-timeout'.  This cancels the effect of
1093      that call to `add-timeout'; the arrival of the specified time will
1094      not cause anything special to happen.  (NOTE: In FSF Emacs, this
1095      function is called `cancel-timer'.)
1096
1097 \1f
1098 File: lispref.info,  Node: Terminal Input,  Next: Terminal Output,  Prev: Timers,  Up: System Interface
1099
1100 Terminal Input
1101 ==============
1102
1103    This section describes functions and variables for recording or
1104 manipulating terminal input.  See *Note Display::, for related
1105 functions.
1106
1107 * Menu:
1108
1109 * Input Modes::         Options for how input is processed.
1110 * Translating Input::   Low level conversion of some characters or events
1111                           into others.
1112 * Recording Input::     Saving histories of recent or all input events.
1113
1114 \1f
1115 File: lispref.info,  Node: Input Modes,  Next: Translating Input,  Up: Terminal Input
1116
1117 Input Modes
1118 -----------
1119
1120  - Function: set-input-mode interrupt flow meta quit-char
1121      This function sets the mode for reading keyboard input.  If
1122      INTERRUPT is non-null, then XEmacs uses input interrupts.  If it is
1123      `nil', then it uses CBREAK mode.  When XEmacs communicates
1124      directly with X, it ignores this argument and uses interrupts if
1125      that is the way it knows how to communicate.
1126
1127      If FLOW is non-`nil', then XEmacs uses XON/XOFF (`C-q', `C-s')
1128      flow control for output to the terminal.  This has no effect except
1129      in CBREAK mode.  *Note Flow Control::.
1130
1131      The default setting is system dependent.  Some systems always use
1132      CBREAK mode regardless of what is specified.
1133
1134      The argument META controls support for input character codes above
1135      127.  If META is `t', XEmacs converts characters with the 8th bit
1136      set into Meta characters.  If META is `nil', XEmacs disregards the
1137      8th bit; this is necessary when the terminal uses it as a parity
1138      bit.  If META is neither `t' nor `nil', XEmacs uses all 8 bits of
1139      input unchanged.  This is good for terminals using European 8-bit
1140      character sets.
1141
1142      If QUIT-CHAR is non-`nil', it specifies the character to use for
1143      quitting.  Normally this character is `C-g'.  *Note Quitting::.
1144
1145    The `current-input-mode' function returns the input mode settings
1146 XEmacs is currently using.
1147
1148  - Function: current-input-mode
1149      This function returns current mode for reading keyboard input.  It
1150      returns a list, corresponding to the arguments of `set-input-mode',
1151      of the form `(INTERRUPT FLOW META QUIT)' in which:
1152     INTERRUPT
1153           is non-`nil' when XEmacs is using interrupt-driven input.  If
1154           `nil', Emacs is using CBREAK mode.
1155
1156     FLOW
1157           is non-`nil' if XEmacs uses XON/XOFF (`C-q', `C-s') flow
1158           control for output to the terminal.  This value has no effect
1159           unless INTERRUPT is non-`nil'.
1160
1161     META
1162           is `t' if XEmacs treats the eighth bit of input characters as
1163           the meta bit; `nil' means XEmacs clears the eighth bit of
1164           every input character; any other value means XEmacs uses all
1165           eight bits as the basic character code.
1166
1167     QUIT
1168           is the character XEmacs currently uses for quitting, usually
1169           `C-g'.
1170
1171 \1f
1172 File: lispref.info,  Node: Translating Input,  Next: Recording Input,  Prev: Input Modes,  Up: Terminal Input
1173
1174 Translating Input Events
1175 ------------------------
1176
1177    This section describes features for translating input events into
1178 other input events before they become part of key sequences.
1179
1180  - Variable: function-key-map
1181      This variable holds a keymap that describes the character sequences
1182      sent by function keys on an ordinary character terminal.  This
1183      keymap uses the same data structure as other keymaps, but is used
1184      differently: it specifies translations to make while reading
1185      events.
1186
1187      If `function-key-map' "binds" a key sequence K to a vector V, then
1188      when K appears as a subsequence _anywhere_ in a key sequence, it
1189      is replaced with the events in V.
1190
1191      For example, VT100 terminals send `<ESC> O P' when the keypad PF1
1192      key is pressed.  Therefore, we want XEmacs to translate that
1193      sequence of events into the single event `pf1'.  We accomplish
1194      this by "binding" `<ESC> O P' to `[pf1]' in `function-key-map',
1195      when using a VT100.
1196
1197      Thus, typing `C-c <PF1>' sends the character sequence `C-c <ESC> O
1198      P'; later the function `read-key-sequence' translates this back
1199      into `C-c <PF1>', which it returns as the vector `[?\C-c pf1]'.
1200
1201      Entries in `function-key-map' are ignored if they conflict with
1202      bindings made in the minor mode, local, or global keymaps.  The
1203      intent is that the character sequences that function keys send
1204      should not have command bindings in their own right.
1205
1206      The value of `function-key-map' is usually set up automatically
1207      according to the terminal's Terminfo or Termcap entry, but
1208      sometimes those need help from terminal-specific Lisp files.
1209      XEmacs comes with terminal-specific files for many common
1210      terminals; their main purpose is to make entries in
1211      `function-key-map' beyond those that can be deduced from Termcap
1212      and Terminfo.  *Note Terminal-Specific::.
1213
1214      Emacs versions 18 and earlier used totally different means of
1215      detecting the character sequences that represent function keys.
1216
1217  - Variable: key-translation-map
1218      This variable is another keymap used just like `function-key-map'
1219      to translate input events into other events.  It differs from
1220      `function-key-map' in two ways:
1221
1222         * `key-translation-map' goes to work after `function-key-map' is
1223           finished; it receives the results of translation by
1224           `function-key-map'.
1225
1226         * `key-translation-map' overrides actual key bindings.
1227
1228      The intent of `key-translation-map' is for users to map one
1229      character set to another, including ordinary characters normally
1230      bound to `self-insert-command'.
1231
1232    You can use `function-key-map' or `key-translation-map' for more
1233 than simple aliases, by using a function, instead of a key sequence, as
1234 the "translation" of a key.  Then this function is called to compute
1235 the translation of that key.
1236
1237    The key translation function receives one argument, which is the
1238 prompt that was specified in `read-key-sequence'--or `nil' if the key
1239 sequence is being read by the editor command loop.  In most cases you
1240 can ignore the prompt value.
1241
1242    If the function reads input itself, it can have the effect of
1243 altering the event that follows.  For example, here's how to define
1244 `C-c h' to turn the character that follows into a Hyper character:
1245
1246      (defun hyperify (prompt)
1247        (let ((e (read-event)))
1248          (vector (if (numberp e)
1249                      (logior (lsh 1 20) e)
1250                    (if (memq 'hyper (event-modifiers e))
1251                        e
1252                      (add-event-modifier "H-" e))))))
1253      
1254      (defun add-event-modifier (string e)
1255        (let ((symbol (if (symbolp e) e (car e))))
1256          (setq symbol (intern (concat string
1257                                       (symbol-name symbol))))
1258          (if (symbolp e)
1259              symbol
1260            (cons symbol (cdr e)))))
1261      
1262      (define-key function-key-map "\C-ch" 'hyperify)
1263
1264    The `iso-transl' library uses this feature to provide a way of
1265 inputting non-ASCII Latin-1 characters.
1266
1267 \1f
1268 File: lispref.info,  Node: Recording Input,  Prev: Translating Input,  Up: Terminal Input
1269
1270 Recording Input
1271 ---------------
1272
1273  - Function: recent-keys &optional number
1274      This function returns a vector containing recent input events from
1275      the keyboard or mouse.  By default, 100 events are recorded, which
1276      is how many `recent-keys' returns.
1277
1278      All input events are included, whether or not they were used as
1279      parts of key sequences.  Thus, you always get the last 100 inputs,
1280      not counting keyboard macros.  (Events from keyboard macros are
1281      excluded because they are less interesting for debugging; it
1282      should be enough to see the events that invoked the macros.)
1283
1284      If NUMBER is specified, not more than NUMBER events will be
1285      returned.  You may change the number of stored events using
1286      `set-recent-keys-ring-size'.
1287
1288  - Function: recent-keys-ring-size
1289      This function returns the number of recent events stored
1290      internally.  This is also the maximum number of events
1291      `recent-keys' can return.  By default, 100 events are stored.
1292
1293  - Function: set-recent-keys-ring-size size
1294      This function changes the number of events stored by XEmacs and
1295      returned by `recent-keys'.
1296
1297      For example, `(set-recent-keys-ring-size 250)' will make XEmacs
1298      remember last 250 events and will make `recent-keys' return last
1299      250 events by default.
1300
1301  - Command: open-dribble-file filename
1302      This function opens a "dribble file" named FILENAME.  When a
1303      dribble file is open, each input event from the keyboard or mouse
1304      (but not those from keyboard macros) is written in that file.  A
1305      non-character event is expressed using its printed representation
1306      surrounded by `<...>'.
1307
1308      You close the dribble file by calling this function with an
1309      argument of `nil'.
1310
1311      This function is normally used to record the input necessary to
1312      trigger an XEmacs bug, for the sake of a bug report.
1313
1314           (open-dribble-file "~/dribble")
1315                => nil
1316
1317    See also the `open-termscript' function (*note Terminal Output::).
1318