annotate man/lispref/os.texi @ 280:7df0dd720c89 r21-0b38

Import from CVS: tag r21-0b38
author cvs
date Mon, 13 Aug 2007 10:32:22 +0200
parents 376386a54a3c
children c9fe270a4101
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @setfilename ../../info/os.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @node System Interface, X-Windows, Processes, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @chapter Operating System Interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 This chapter is about starting and getting out of Emacs, access to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 values in the operating system environment, and terminal input, output,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 and flow control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 @xref{Building XEmacs}, for related information. See also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @ref{Display}, for additional operating system status information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 pertaining to the terminal and the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 * Starting Up:: Customizing XEmacs start-up processing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 * Getting Out:: How exiting works (permanent or temporary).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 * System Environment:: Distinguish the name and kind of system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 * User Identification:: Finding the name and user id of the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 * Time of Day:: Getting the current time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 * Time Conversion:: Converting a time from numeric form to a string, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 to calendrical data (or vice versa).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 * Timers:: Setting a timer to call a function at a certain time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 * Terminal Input:: Recording terminal input for debugging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Terminal Output:: Recording terminal output for debugging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 * Flow Control:: How to turn output flow control on or off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Batch Mode:: Running XEmacs without terminal interaction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * Special Keysyms:: Defining system-specific key symbols for X windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 @node Starting Up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 @section Starting Up XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 This section describes what XEmacs does when it is started, and how you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 can customize these actions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 * Start-up Summary:: Sequence of actions XEmacs performs at start-up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 * Init File:: Details on reading the init file (@file{.emacs}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 * Terminal-Specific:: How the terminal-specific Lisp file is read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 * Command Line Arguments:: How command line arguments are processed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 and how you can customize them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 @node Start-up Summary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 @subsection Summary: Sequence of Actions at Start Up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 @cindex initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 @cindex start up of XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 @cindex @file{startup.el}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 The order of operations performed (in @file{startup.el}) by XEmacs when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 it is started up is as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 @enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 It loads the initialization library for the window system, if you are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 using a window system. This library's name is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 @file{term/@var{windowsystem}-win.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 It processes the initial options. (Some of them are handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 even earlier than this.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 It initializes the X window frame and faces, if appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 It runs the normal hook @code{before-init-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 It loads the library @file{site-start}, unless the option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 @samp{-no-site-file} was specified. The library's file name is usually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @file{site-start.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @cindex @file{site-start.el}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 It loads the file @file{~/.emacs} unless @samp{-q} was specified on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 the command line. (This is not done in @samp{-batch} mode.) The @samp{-u}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 option can specify the user name whose home directory should be used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 instead of @file{~}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 It loads the library @file{default} unless @code{inhibit-default-init}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 is non-@code{nil}. (This is not done in @samp{-batch} mode or if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 @samp{-q} was specified on the command line.) The library's file name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 is usually @file{default.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 @cindex @file{default.el}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 It runs the normal hook @code{after-init-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 It sets the major mode according to @code{initial-major-mode}, provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 the buffer @samp{*scratch*} is still current and still in Fundamental
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 It loads the terminal-specific Lisp file, if any, except when in batch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 mode or using a window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 It displays the initial echo area message, unless you have suppressed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 that with @code{inhibit-startup-echo-area-message}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 It processes the action arguments from the command line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 It runs @code{term-setup-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 It calls @code{frame-notice-user-settings}, which modifies the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 parameters of the selected frame according to whatever the init files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 specify.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 It runs @code{window-setup-hook}. @xref{Terminal-Specific}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 It displays copyleft, nonwarranty, and basic use information, provided
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 there were no remaining command line arguments (a few steps above) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 the value of @code{inhibit-startup-message} is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 @end enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @defopt inhibit-startup-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 This variable inhibits the initial startup messages (the nonwarranty,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 etc.). If it is non-@code{nil}, then the messages are not printed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 This variable exists so you can set it in your personal init file, once
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 you are familiar with the contents of the startup message. Do not set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 this variable in the init file of a new user, or in a way that affects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 more than one user, because that would prevent new users from receiving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 the information they are supposed to see.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @defopt inhibit-startup-echo-area-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 This variable controls the display of the startup echo area message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 You can suppress the startup echo area message by adding text with this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 form to your @file{.emacs} file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (setq inhibit-startup-echo-area-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 "@var{your-login-name}")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Simply setting @code{inhibit-startup-echo-area-message} to your login
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 name is not sufficient to inhibit the message; Emacs explicitly checks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 whether @file{.emacs} contains an expression as shown above. Your login
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 name must appear in the expression as a Lisp string constant.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 This way, you can easily inhibit the message for yourself if you wish,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 but thoughtless copying of your @file{.emacs} file will not inhibit the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 message for someone else.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 @node Init File
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 @subsection The Init File: @file{.emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 @cindex init file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 @cindex @file{.emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 When you start XEmacs, it normally attempts to load the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 @file{.emacs} from your home directory. This file, if it exists, must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 contain Lisp code. It is called your @dfn{init file}. The command line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 switches @samp{-q} and @samp{-u} affect the use of the init file;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @samp{-q} says not to load an init file, and @samp{-u} says to load a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 specified user's init file instead of yours. @xref{Entering XEmacs,,,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 emacs, The XEmacs Reference Manual}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 @cindex default init file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 A site may have a @dfn{default init file}, which is the library named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 @file{default.el}. XEmacs finds the @file{default.el} file through the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 standard search path for libraries (@pxref{How Programs Do Loading}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 The XEmacs distribution does not come with this file; sites may provide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 one for local customizations. If the default init file exists, it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 loaded whenever you start Emacs, except in batch mode or if @samp{-q} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 specified. But your own personal init file, if any, is loaded first; if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 it sets @code{inhibit-default-init} to a non-@code{nil} value, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 XEmacs does not subsequently load the @file{default.el} file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 Another file for site-customization is @file{site-start.el}. Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 loads this @emph{before} the user's init file. You can inhibit the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 loading of this file with the option @samp{-no-site-file}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 @defvar site-run-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 This variable specifies the site-customization file to load
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 before the user's init file. Its normal value is @code{"site-start"}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 If there is a great deal of code in your @file{.emacs} file, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 should move it into another file named @file{@var{something}.el},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 byte-compile it (@pxref{Byte Compilation}), and make your @file{.emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 file load the other file using @code{load} (@pxref{Loading}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @xref{Init File Examples,,, emacs, The XEmacs Reference Manual}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 examples of how to make various commonly desired customizations in your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @file{.emacs} file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 @defopt inhibit-default-init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 This variable prevents XEmacs from loading the default initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 library file for your session of XEmacs. If its value is non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 then the default library is not loaded. The default value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 @defvar before-init-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 @defvarx after-init-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 These two normal hooks are run just before, and just after, loading of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 the user's init file, @file{default.el}, and/or @file{site-start.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 @node Terminal-Specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 @subsection Terminal-Specific Initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 @cindex terminal-specific initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 Each terminal type can have its own Lisp library that XEmacs loads when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 run on that type of terminal. For a terminal type named @var{termtype},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 the library is called @file{term/@var{termtype}}. XEmacs finds the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 by searching the @code{load-path} directories as it does for other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 files, and trying the @samp{.elc} and @samp{.el} suffixes. Normally,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 terminal-specific Lisp library is located in @file{emacs/lisp/term}, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 subdirectory of the @file{emacs/lisp} directory in which most XEmacs Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 libraries are kept.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 The library's name is constructed by concatenating the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 variable @code{term-file-prefix} and the terminal type. Normally,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 @code{term-file-prefix} has the value @code{"term/"}; changing this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 is not recommended.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 The usual function of a terminal-specific library is to enable special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 keys to send sequences that XEmacs can recognize. It may also need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 set or add to @code{function-key-map} if the Termcap entry does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 specify all the terminal's function keys. @xref{Terminal Input}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 @cindex Termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 When the name of the terminal type contains a hyphen, only the part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 the name before the first hyphen is significant in choosing the library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 name. Thus, terminal types @samp{aaa-48} and @samp{aaa-30-rv} both use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 the @file{term/aaa} library. If necessary, the library can evaluate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 @code{(getenv "TERM")} to find the full name of the terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 type.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 Your @file{.emacs} file can prevent the loading of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 terminal-specific library by setting the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @code{term-file-prefix} to @code{nil}. This feature is useful when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 experimenting with your own peculiar customizations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 You can also arrange to override some of the actions of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 terminal-specific library by setting the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @code{term-setup-hook}. This is a normal hook which XEmacs runs using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @code{run-hooks} at the end of XEmacs initialization, after loading both
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 your @file{.emacs} file and any terminal-specific libraries. You can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 use this variable to define initializations for terminals that do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 have their own libraries. @xref{Hooks}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 @defvar term-file-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @cindex @code{TERM} environment variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 If the @code{term-file-prefix} variable is non-@code{nil}, XEmacs loads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 a terminal-specific initialization file as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (load (concat term-file-prefix (getenv "TERM")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 You may set the @code{term-file-prefix} variable to @code{nil} in your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 @file{.emacs} file if you do not wish to load the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 terminal-initialization file. To do this, put the following in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 your @file{.emacs} file: @code{(setq term-file-prefix nil)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @defvar term-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 This variable is a normal hook that XEmacs runs after loading your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 @file{.emacs} file, the default initialization file (if any) and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 terminal-specific Lisp file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 You can use @code{term-setup-hook} to override the definitions made by a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 terminal-specific file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 @defvar window-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 This variable is a normal hook which XEmacs runs after loading your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 @file{.emacs} file and the default initialization file (if any), after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 loading terminal-specific Lisp code, and after running the hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 @code{term-setup-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 @node Command Line Arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 @subsection Command Line Arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @cindex command line arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 You can use command line arguments to request various actions when you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 start XEmacs. Since you do not need to start XEmacs more than once per
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 day, and will often leave your XEmacs session running longer than that,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 command line arguments are hardly ever used. As a practical matter, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 is best to avoid making the habit of using them, since this habit would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 encourage you to kill and restart XEmacs unnecessarily often. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 options exist for two reasons: to be compatible with other editors (for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 invocation by other programs) and to enable shell scripts to run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 specific Lisp programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 This section describes how Emacs processes command line arguments,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 and how you can customize them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (Note that some other editors require you to start afresh each time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 you want to edit a file. With this kind of editor, you will probably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 specify the file as a command line argument. The recommended way to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 use XEmacs is to start it only once, just after you log in, and do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 all your editing in the same XEmacs process. Each time you want to edit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 a different file, you visit it with the existing XEmacs, which eventually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 comes to have many files in it ready for editing. Usually you do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 kill the XEmacs until you are about to log out.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @defun command-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 This function parses the command line that XEmacs was called with,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 processes it, loads the user's @file{.emacs} file and displays the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 startup messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 @defvar command-line-processed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 The value of this variable is @code{t} once the command line has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 If you redump XEmacs by calling @code{dump-emacs}, you may wish to set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 this variable to @code{nil} first in order to cause the new dumped XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 to process its new command line arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @defvar command-switch-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 @cindex switches on command line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 @cindex options on command line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @cindex command line options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 The value of this variable is an alist of user-defined command-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 options and associated handler functions. This variable exists so you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 can add elements to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 A @dfn{command line option} is an argument on the command line of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 -@var{option}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 The elements of the @code{command-switch-alist} look like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (@var{option} . @var{handler-function})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 The @var{handler-function} is called to handle @var{option} and receives
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 the option name as its sole argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 In some cases, the option is followed in the command line by an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 argument. In these cases, the @var{handler-function} can find all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 remaining command-line arguments in the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 @code{command-line-args-left}. (The entire list of command-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 arguments is in @code{command-line-args}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 The command line arguments are parsed by the @code{command-line-1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 function in the @file{startup.el} file. See also @ref{Command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 Switches, , Command Line Switches and Arguments, emacs, The XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 Reference Manual}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @defvar command-line-args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 The value of this variable is the list of command line arguments passed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 to XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 @defvar command-line-functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 This variable's value is a list of functions for handling an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 unrecognized command-line argument. Each time the next argument to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 processed has no special meaning, the functions in this list are called,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 in order of appearance, until one of them returns a non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 These functions are called with no arguments. They can access the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 command-line argument under consideration through the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @code{argi}. The remaining arguments (not including the current one)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 are in the variable @code{command-line-args-left}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 When a function recognizes and processes the argument in @code{argi}, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 should return a non-@code{nil} value to say it has dealt with that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 argument. If it has also dealt with some of the following arguments, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 can indicate that by deleting them from @code{command-line-args-left}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 If all of these functions return @code{nil}, then the argument is used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 as a file name to visit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @node Getting Out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 @section Getting out of XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @cindex exiting XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 There are two ways to get out of XEmacs: you can kill the XEmacs job,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 which exits permanently, or you can suspend it, which permits you to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 reenter the XEmacs process later. As a practical matter, you seldom kill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 XEmacs---only when you are about to log out. Suspending is much more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 common.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 * Killing XEmacs:: Exiting XEmacs irreversibly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 * Suspending XEmacs:: Exiting XEmacs reversibly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @node Killing XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 @subsection Killing XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 @cindex killing XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 Killing XEmacs means ending the execution of the XEmacs process. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 parent process normally resumes control. The low-level primitive for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 killing XEmacs is @code{kill-emacs}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 @defun kill-emacs &optional exit-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 This function exits the XEmacs process and kills it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 If @var{exit-data} is an integer, then it is used as the exit status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 of the XEmacs process. (This is useful primarily in batch operation; see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 @ref{Batch Mode}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 If @var{exit-data} is a string, its contents are stuffed into the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 terminal input buffer so that the shell (or whatever program next reads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 input) can read them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 All the information in the XEmacs process, aside from files that have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 been saved, is lost when the XEmacs is killed. Because killing XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 inadvertently can lose a lot of work, XEmacs queries for confirmation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 before actually terminating if you have buffers that need saving or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 subprocesses that are running. This is done in the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 @code{save-buffers-kill-emacs}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 @defvar kill-emacs-query-functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 After asking the standard questions, @code{save-buffers-kill-emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 calls the functions in the list @code{kill-buffer-query-functions}, in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 order of appearance, with no arguments. These functions can ask for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 additional confirmation from the user. If any of them returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 non-@code{nil}, XEmacs is not killed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 @defvar kill-emacs-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 This variable is a normal hook; once @code{save-buffers-kill-emacs} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 finished with all file saving and confirmation, it runs the functions in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 this hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 @node Suspending XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 @subsection Suspending XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 @cindex suspending XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 @dfn{Suspending XEmacs} means stopping XEmacs temporarily and returning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 control to its superior process, which is usually the shell. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 allows you to resume editing later in the same XEmacs process, with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 same buffers, the same kill ring, the same undo history, and so on. To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 resume XEmacs, use the appropriate command in the parent shell---most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 likely @code{fg}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 Some operating systems do not support suspension of jobs; on these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 systems, ``suspension'' actually creates a new shell temporarily as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 subprocess of XEmacs. Then you would exit the shell to return to XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 Suspension is not useful with window systems such as X, because the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 XEmacs job may not have a parent that can resume it again, and in any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 case you can give input to some other job such as a shell merely by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 moving to a different window. Therefore, suspending is not allowed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 when XEmacs is an X client.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 @defun suspend-emacs string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 This function stops XEmacs and returns control to the superior process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 If and when the superior process resumes XEmacs, @code{suspend-emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 returns @code{nil} to its caller in Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 If @var{string} is non-@code{nil}, its characters are sent to be read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 as terminal input by XEmacs's superior shell. The characters in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 @var{string} are not echoed by the superior shell; only the results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 appear.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 Before suspending, @code{suspend-emacs} runs the normal hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 @code{suspend-hook}. In Emacs version 18, @code{suspend-hook} was not a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 normal hook; its value was a single function, and if its value was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 non-@code{nil}, then @code{suspend-emacs} returned immediately without
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 actually suspending anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 After the user resumes XEmacs, @code{suspend-emacs} runs the normal hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 @code{suspend-resume-hook}. @xref{Hooks}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 The next redisplay after resumption will redraw the entire screen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 unless the variable @code{no-redraw-on-reenter} is non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (@pxref{Refresh Screen}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 In the following example, note that @samp{pwd} is not echoed after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 XEmacs is suspended. But it is read and executed by the shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (suspend-emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (add-hook 'suspend-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (or (y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 "Really suspend? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (error "Suspend cancelled")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @result{} (lambda nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (or (y-or-n-p "Really suspend? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (error "Suspend cancelled")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (add-hook 'suspend-resume-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (function (lambda () (message "Resumed!"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 @result{} (lambda nil (message "Resumed!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (suspend-emacs "pwd")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ---------- Buffer: Minibuffer ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 Really suspend? @kbd{y}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ---------- Buffer: Minibuffer ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ---------- Parent Shell ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 lewis@@slug[23] % /user/lewis/manual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 lewis@@slug[24] % fg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ---------- Echo Area ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 Resumed!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 @defvar suspend-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 This variable is a normal hook run before suspending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 @defvar suspend-resume-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 This variable is a normal hook run after suspending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @node System Environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 @section Operating System Environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 @cindex operating system environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 XEmacs provides access to variables in the operating system environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 through various functions. These variables include the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 system, the user's @sc{uid}, and so on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 @defvar system-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 The value of this variable is a symbol indicating the type of operating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 system XEmacs is operating on. Here is a table of the possible values:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 @item aix-v3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 AIX.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 @item berkeley-unix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 Berkeley BSD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @item dgux
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 Data General DGUX operating system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @item gnu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 A GNU system using the GNU HURD and Mach.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 @item hpux
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 Hewlett-Packard HPUX operating system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 @item irix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 Silicon Graphics Irix system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 @item linux
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 A GNU system using the Linux kernel.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 @item ms-dos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 Microsoft MS-DOS ``operating system.''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 @item next-mach
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 NeXT Mach-based system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 @item rtu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 Masscomp RTU, UCB universe.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 @item unisoft-unix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 UniSoft UniPlus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 @item usg-unix-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 AT&T System V.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 @item vax-vms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 VAX VMS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 @item windows-nt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 Microsoft windows NT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 @item xenix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 SCO Xenix 386.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 We do not wish to add new symbols to make finer distinctions unless it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 is absolutely necessary! In fact, we hope to eliminate some of these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 alternatives in the future. We recommend using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 @code{system-configuration} to distinguish between different operating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 systems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 @defvar system-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 This variable holds the three-part configuration name for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 hardware/software configuration of your system, as a string. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 convenient way to test parts of this string is with @code{string-match}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 @defun system-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 This function returns the name of the machine you are running on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (system-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 @result{} "prep.ai.mit.edu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @vindex system-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 The symbol @code{system-name} is a variable as well as a function. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 fact, the function returns whatever value the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 @code{system-name} currently holds. Thus, you can set the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 @code{system-name} in case Emacs is confused about the name of your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 system. The variable is also useful for constructing frame titles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (@pxref{Frame Titles}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 @defvar mail-host-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 If this variable is non-@code{nil}, it is used instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 @code{system-name} for purposes of generating email addresses. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 example, it is used when constructing the default value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 @code{user-mail-address}. @xref{User Identification}. (Since this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 done when XEmacs starts up, the value actually used is the one saved when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 XEmacs was dumped. @xref{Building XEmacs}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 @defun getenv var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 @cindex environment variable access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 This function returns the value of the environment variable @var{var},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 as a string. Within XEmacs, the environment variable values are kept in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 the Lisp variable @code{process-environment}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (getenv "USER")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 @result{} "lewis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 lewis@@slug[10] % printenv
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 PATH=.:/user/lewis/bin:/usr/bin:/usr/local/bin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 USER=lewis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 TERM=ibmapa16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 SHELL=/bin/csh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 HOME=/user/lewis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 @deffn Command setenv variable value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 This command sets the value of the environment variable named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 @var{variable} to @var{value}. Both arguments should be strings. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 function works by modifying @code{process-environment}; binding that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 variable with @code{let} is also reasonable practice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 @defvar process-environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 This variable is a list of strings, each describing one environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 variable. The functions @code{getenv} and @code{setenv} work by means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 of this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 process-environment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 @result{} ("l=/usr/stanford/lib/gnuemacs/lisp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 "USER=lewis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 "TERM=ibmapa16"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 "SHELL=/bin/csh"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 "HOME=/user/lewis")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 @defvar path-separator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 This variable holds a string which says which character separates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 directories in a search path (as found in an environment variable). Its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 value is @code{":"} for Unix and GNU systems, and @code{";"} for MS-DOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 and Windows NT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 @defvar invocation-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 This variable holds the program name under which Emacs was invoked. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 value is a string, and does not include a directory name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 @defvar invocation-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 This variable holds the directory from which the Emacs executable was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 invoked, or perhaps @code{nil} if that directory cannot be determined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 @defvar installation-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 If non-@code{nil}, this is a directory within which to look for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 @file{lib-src} and @file{etc} subdirectories. This is non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 when Emacs can't find those directories in their standard installed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 locations, but can find them in a directory related somehow to the one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 containing the Emacs executable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
726 @defun load-average &optional use-floats
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
727 This function returns a list of the current 1-minute, 5-minute and
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
728 15-minute load averages. The values are integers that are 100 times the
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
729 system load averages. (The load averages indicate the number of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 processes trying to run.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
732 When @var{use-floats} is non-@code{nil}, floats will be returned instead
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
733 of integers. These floats are not multiplied by 100.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
734
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (load-average)
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
738 @result{} (169 158 164)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
739 (load-average t)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
740 @result{} (1.69921875 1.58984375 1.640625)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 lewis@@rocky[5] % uptime
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
745 8:06pm up 16 day(s), 21:57, 40 users,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
746 load average: 1.68, 1.59, 1.64
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 @end example
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
749
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
750 If the 5-minute or 15-minute load averages are not available, return a
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
751 shortened list, containing only those averages which are available.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
752
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
753 On some systems, this function may require special privileges to run, or
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
754 it may be unimplemented for the particular system type. In that case,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
755 the function will signal an error.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 @defun emacs-pid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 This function returns the process @sc{id} of the Emacs process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 @defun setprv privilege-name &optional setp getprv
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 This function sets or resets a VMS privilege. (It does not exist on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 Unix.) The first arg is the privilege name, as a string. The second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 argument, @var{setp}, is @code{t} or @code{nil}, indicating whether the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 privilege is to be turned on or off. Its default is @code{nil}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 function returns @code{t} if successful, @code{nil} otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 does not change the privilege, but returns @code{t} or @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 indicating whether the privilege is currently enabled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 @node User Identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 @section User Identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 @defvar user-mail-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 This holds the nominal email address of the user who is using Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 When Emacs starts up, it computes a default value that is usually right,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 but users often set this themselves when the default value is not right.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 @defun user-login-name &optional uid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 If you don't specify @var{uid}, this function returns the name under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 which the user is logged in. If the environment variable @code{LOGNAME}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 is set, that value is used. Otherwise, if the environment variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 @code{USER} is set, that value is used. Otherwise, the value is based
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 on the effective @sc{uid}, not the real @sc{uid}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 If you specify @var{uid}, the value is the user name that corresponds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 to @var{uid} (which should be an integer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (user-login-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 @result{} "lewis"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 @defun user-real-login-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 This function returns the user name corresponding to Emacs's real
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 @sc{uid}. This ignores the effective @sc{uid} and ignores the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 environment variables @code{LOGNAME} and @code{USER}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
807 @defvar user-full-name
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
808 This variable holds the name of the user running this Emacs. It is
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
809 initialized at startup time from the value of @code{NAME} environment
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
810 variable. You can change the value of this variable to alter the result
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
811 of the @code{user-full-name} function.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
812 @end defvar
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
813
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
814 @defun user-full-name &optional user
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
815 This function returns the full name of @var{user}. If @var{user} is
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
816 @code{nil}, it defaults to the user running this Emacs. In that case,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
817 the value of @code{user-full-name} variable, if non-@code{nil}, will be
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
818 used.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
819
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
820 If @var{user} is specified explicitly, @code{user-full-name} variable is
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
821 ignored.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (user-full-name)
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
826 @result{} "Hrvoje Niksic"
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
827 (setq user-full-name "Hrvoje \"Niksa\" Niksic")
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
828 (user-full-name)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
829 @result{} "Hrvoje \"Niksa\" Niksic"
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
830 (user-full-name "hniksic")
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
831 @result{} "Hrvoje Niksic"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 @vindex user-full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 @vindex user-real-login-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 @vindex user-login-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 The symbols @code{user-login-name}, @code{user-real-login-name} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 @code{user-full-name} are variables as well as functions. The functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 return the same values that the variables hold. These variables allow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 you to ``fake out'' Emacs by telling the functions what to return. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 variables are also useful for constructing frame titles (@pxref{Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 Titles}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 @defun user-real-uid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 This function returns the real @sc{uid} of the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (user-real-uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 @result{} 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 @defun user-uid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 This function returns the effective @sc{uid} of the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 @node Time of Day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 @section Time of Day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 This section explains how to determine the current time and the time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 zone.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 @defun current-time-string &optional time-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 This function returns the current time and date as a humanly-readable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 string. The format of the string is unvarying; the number of characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 used for each part is always the same, so you can reliably use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 @code{substring} to extract pieces of it. It is wise to count the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 characters from the beginning of the string rather than from the end, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 additional information may be added at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 The argument @var{time-value}, if given, specifies a time to format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 instead of the current time. The argument should be a list whose first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 two elements are integers. Thus, you can use times obtained from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 @code{current-time} (see below) and from @code{file-attributes}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (@pxref{File Attributes}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (current-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 @result{} "Wed Oct 14 22:21:05 1987"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 @defun current-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 This function returns the system's time value as a list of three
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 integers: @code{(@var{high} @var{low} @var{microsec})}. The integers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 @var{high} and @var{low} combine to give the number of seconds since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 0:00 January 1, 1970, which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 @var{high} * 2**16 + @var{low}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 @tex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 $high*2^{16}+low$.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 @end tex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 The third element, @var{microsec}, gives the microseconds since the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 start of the current second (or 0 for systems that return time only on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 the resolution of a second).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 The first two elements can be compared with file time values such as you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 get with the function @code{file-attributes}. @xref{File Attributes}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 @defun current-time-zone &optional time-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 This function returns a list describing the time zone that the user is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 The value has the form @code{(@var{offset} @var{name})}. Here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 @var{offset} is an integer giving the number of seconds ahead of UTC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (east of Greenwich). A negative value means west of Greenwich. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 second element, @var{name} is a string giving the name of the time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 zone. Both elements change when daylight savings time begins or ends;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 if the user has specified a time zone that does not use a seasonal time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 adjustment, then the value is constant through time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 If the operating system doesn't supply all the information necessary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 compute the value, both elements of the list are @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 The argument @var{time-value}, if given, specifies a time to analyze
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 instead of the current time. The argument should be a cons cell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 containing two integers, or a list whose first two elements are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 integers. Thus, you can use times obtained from @code{current-time}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (see above) and from @code{file-attributes} (@pxref{File Attributes}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 @node Time Conversion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 @section Time Conversion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 These functions convert time values (lists of two or three integers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 to strings or to calendrical information. There is also a function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 convert calendrical information to a time value. You can get time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 values from the functions @code{current-time} (@pxref{Time of Day}) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 @code{file-attributes} (@pxref{File Attributes}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
943 @defun format-time-string format-string &optional time
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 This function converts @var{time} to a string according to
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
945 @var{format-string}. If @var{time} is omitted, it defaults to the
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 0
diff changeset
946 current time. The argument @var{format-string} may contain
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 @samp{%}-sequences which say to substitute parts of the time. Here is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 table of what the @samp{%}-sequences mean:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 @item %a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 This stands for the abbreviated name of the day of week.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 @item %A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 This stands for the full name of the day of week.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 @item %b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 This stands for the abbreviated name of the month.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 @item %B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 This stands for the full name of the month.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 @item %c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 This is a synonym for @samp{%x %X}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 @item %C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 This has a locale-specific meaning. In the default locale (named C), it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 is equivalent to @samp{%A, %B %e, %Y}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 @item %d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 This stands for the day of month, zero-padded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 @item %D
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 This is a synonym for @samp{%m/%d/%y}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 @item %e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 This stands for the day of month, blank-padded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 @item %h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 This is a synonym for @samp{%b}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 @item %H
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 This stands for the hour (00-23).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 @item %I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 This stands for the hour (00-12).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 @item %j
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 This stands for the day of the year (001-366).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 @item %k
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 This stands for the hour (0-23), blank padded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 @item %l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 This stands for the hour (1-12), blank padded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 @item %m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 This stands for the month (01-12).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 @item %M
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 This stands for the minute (00-59).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 @item %n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 This stands for a newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 @item %p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 This stands for @samp{AM} or @samp{PM}, as appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 @item %r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 This is a synonym for @samp{%I:%M:%S %p}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 @item %R
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 This is a synonym for @samp{%H:%M}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 @item %S
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 This stands for the seconds (00-60).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 @item %t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 This stands for a tab character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 @item %T
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 This is a synonym for @samp{%H:%M:%S}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 @item %U
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 This stands for the week of the year (01-52), assuming that weeks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 start on Sunday.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 @item %w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 This stands for the numeric day of week (0-6). Sunday is day 0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 @item %W
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 This stands for the week of the year (01-52), assuming that weeks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 start on Monday.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 @item %x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 This has a locale-specific meaning. In the default locale (named C), it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 is equivalent to @samp{%D}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 @item %X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 This has a locale-specific meaning. In the default locale (named C), it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 is equivalent to @samp{%T}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 @item %y
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 This stands for the year without century (00-99).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 @item %Y
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 This stands for the year with century.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 @item %Z
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 This stands for the time zone abbreviation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 @defun decode-time time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 This function converts a time value into calendrical information. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 return value is a list of nine elements, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{zone})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 Here is what the elements mean:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 @item sec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 The number of seconds past the minute, as an integer between 0 and 59.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 @item minute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 The number of minutes past the hour, as an integer between 0 and 59.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 @item hour
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 The hour of the day, as an integer between 0 and 23.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 @item day
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 The day of the month, as an integer between 1 and 31.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 @item month
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 The month of the year, as an integer between 1 and 12.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 @item year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 The year, an integer typically greater than 1900.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 @item dow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 The day of week, as an integer between 0 and 6, where 0 stands for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 Sunday.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 @item dst
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 @code{t} if daylight savings time is effect, otherwise @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 @item zone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 An integer indicating the time zone, as the number of seconds east of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 Greenwich.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 Note that Common Lisp has different meanings for @var{dow} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 @var{zone}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 @defun encode-time seconds minutes hour day month year &optional zone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 This function is the inverse of @code{decode-time}. It converts seven
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 items of calendrical data into a time value. For the meanings of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 arguments, see the table above under @code{decode-time}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 Year numbers less than 100 are treated just like other year numbers. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 you want them to stand for years above 1900, you must alter them yourself
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 before you call @code{encode-time}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 The optional argument @var{zone} defaults to the current time zone and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 its daylight savings time rules. If specified, it can be either a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (as you would get from @code{current-time-zone}) or an integer (as you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 would get from @code{decode-time}). The specified zone is used without
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 any further alteration for daylight savings time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 @node Timers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 @section Timers for Delayed Execution
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 You can set up a timer to call a function at a specified future time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 @c All different in FSF 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 @defun add-timeout secs function object &optional resignal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 This function adds a timeout, to be signaled after the timeout period
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 has elapsed. @var{secs} is a number of seconds, expressed as an integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 or a float. @var{function} will be called after that many seconds have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 elapsed, with one argument, the given @var{object}. If the optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 @var{resignal} argument is provided, then after this timeout expires,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 `add-timeout' will automatically be called again with @var{resignal} as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 first argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 This function returns an object which is the @dfn{id} of this particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 timeout. You can pass that object to @code{disable-timeout} to turn off
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 the timeout before it has been signalled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 The number of seconds may be expressed as a floating-point number, in which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 case some fractional part of a second will be used. Caveat: the usable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 timeout granularity will vary from system to system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 Adding a timeout causes a timeout event to be returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 @code{next-event}, and the function will be invoked by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 @code{dispatch-event}, so if XEmacs is in a tight loop, the function will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 not be invoked until the next call to sit-for or until the return to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 top-level (the same is true of process filters).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 WARNING: if you are thinking of calling add-timeout from inside of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 callback function as a way of resignalling a timeout, think again. There
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 is a race condition. That's why the @var{resignal} argument exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (NOTE: In FSF Emacs, this function is called @code{run-at-time} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 has different semantics.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 @defun disable-timeout id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 Cancel the requested action for @var{id}, which should be a value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 previously returned by @code{add-timeout}. This cancels the effect of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 that call to @code{add-timeout}; the arrival of the specified time will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 not cause anything special to happen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (NOTE: In FSF Emacs, this function is called @code{cancel-timer}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 @node Terminal Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 @section Terminal Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 @cindex terminal input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 This section describes functions and variables for recording or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 manipulating terminal input. See @ref{Display}, for related
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 * Input Modes:: Options for how input is processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 * Translating Input:: Low level conversion of some characters or events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 into others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 * Recording Input:: Saving histories of recent or all input events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 @node Input Modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 @subsection Input Modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 @cindex input modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 @cindex terminal input modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 @defun set-input-mode interrupt flow meta quit-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 This function sets the mode for reading keyboard input. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 @var{interrupt} is non-null, then XEmacs uses input interrupts. If it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 @code{nil}, then it uses @sc{cbreak} mode. When XEmacs communicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 directly with X, it ignores this argument and uses interrupts if that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 the way it knows how to communicate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 If @var{flow} is non-@code{nil}, then XEmacs uses @sc{xon/xoff} (@kbd{C-q},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 @kbd{C-s}) flow control for output to the terminal. This has no effect except
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 in @sc{cbreak} mode. @xref{Flow Control}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 The default setting is system dependent. Some systems always use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 @sc{cbreak} mode regardless of what is specified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 The argument @var{meta} controls support for input character codes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 above 127. If @var{meta} is @code{t}, XEmacs converts characters with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 the 8th bit set into Meta characters. If @var{meta} is @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 XEmacs disregards the 8th bit; this is necessary when the terminal uses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 it as a parity bit. If @var{meta} is neither @code{t} nor @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 XEmacs uses all 8 bits of input unchanged. This is good for terminals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 using European 8-bit character sets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 If @var{quit-char} is non-@code{nil}, it specifies the character to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 use for quitting. Normally this character is @kbd{C-g}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 @xref{Quitting}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 The @code{current-input-mode} function returns the input mode settings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 XEmacs is currently using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 @defun current-input-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 This function returns current mode for reading keyboard input. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 returns a list, corresponding to the arguments of @code{set-input-mode},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 of the form @code{(@var{interrupt} @var{flow} @var{meta} @var{quit})} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 which:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 @item interrupt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 is non-@code{nil} when XEmacs is using interrupt-driven input. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 @code{nil}, Emacs is using @sc{cbreak} mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 @item flow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 is non-@code{nil} if XEmacs uses @sc{xon/xoff} (@kbd{C-q}, @kbd{C-s})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 flow control for output to the terminal. This value has no effect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 unless @var{interrupt} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 @item meta
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 is @code{t} if XEmacs treats the eighth bit of input characters as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 the meta bit; @code{nil} means XEmacs clears the eighth bit of every
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 input character; any other value means XEmacs uses all eight bits as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 basic character code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 @item quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 is the character XEmacs currently uses for quitting, usually @kbd{C-g}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 @node Translating Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 @subsection Translating Input Events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 @cindex translating input events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 This section describes features for translating input events into other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 input events before they become part of key sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 @ignore Not in XEmacs yet.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 @defvar extra-keyboard-modifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 This variable lets Lisp programs ``press'' the modifier keys on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 keyboard. The value is a bit mask:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 The @key{SHIFT} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 @item 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 The @key{LOCK} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 @item 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 The @key{CTL} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 @item 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 The @key{META} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 Each time the user types a keyboard key, it is altered as if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 modifier keys specified in the bit mask were held down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 When using X windows, the program can ``press'' any of the modifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 keys in this way. Otherwise, only the @key{CTL} and @key{META} keys can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 be virtually pressed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 @defvar keyboard-translate-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 This variable is the translate table for keyboard characters. It lets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 you reshuffle the keys on the keyboard without changing any command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 bindings. Its value must be a string or @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 If @code{keyboard-translate-table} is a string, then each character read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 from the keyboard is looked up in this string and the character in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 string is used instead. If the string is of length @var{n}, character codes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 @var{n} and up are untranslated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 In the example below, we set @code{keyboard-translate-table} to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 string of 128 characters. Then we fill it in to swap the characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 @kbd{C-s} and @kbd{C-\} and the characters @kbd{C-q} and @kbd{C-^}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 Subsequently, typing @kbd{C-\} has all the usual effects of typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 @kbd{C-s}, and vice versa. (@xref{Flow Control} for more information on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 this subject.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 @cindex flow control example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (defun evade-flow-control ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 "Replace C-s with C-\ and C-q with C-^."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (let ((the-table (make-string 128 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (let ((i 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (while (< i 128)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (aset the-table i i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (setq i (1+ i))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ;; @r{Swap @kbd{C-s} and @kbd{C-\}.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (aset the-table ?\034 ?\^s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (aset the-table ?\^s ?\034)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 ;; @r{Swap @kbd{C-q} and @kbd{C-^}.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (aset the-table ?\036 ?\^q)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (aset the-table ?\^q ?\036)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (setq keyboard-translate-table the-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 Note that this translation is the first thing that happens to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 character after it is read from the terminal. Record-keeping features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 such as @code{recent-keys} and dribble files record the characters after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 translation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 @defun keyboard-translate from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 This function modifies @code{keyboard-translate-table} to translate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 character code @var{from} into character code @var{to}. It creates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 or enlarges the translate table if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 @defvar function-key-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 This variable holds a keymap that describes the character sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 sent by function keys on an ordinary character terminal. This keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 uses the same data structure as other keymaps, but is used differently: it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 specifies translations to make while reading events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 key sequence, it is replaced with the events in @var{v}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 For example, VT100 terminals send @kbd{@key{ESC} O P} when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 keypad PF1 key is pressed. Therefore, we want XEmacs to translate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 that sequence of events into the single event @code{pf1}. We accomplish
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 this by ``binding'' @kbd{@key{ESC} O P} to @code{[pf1]} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 @code{function-key-map}, when using a VT100.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 @key{ESC} O P}; later the function @code{read-key-sequence} translates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 this back into @kbd{C-c @key{PF1}}, which it returns as the vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 @code{[?\C-c pf1]}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 Entries in @code{function-key-map} are ignored if they conflict with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 bindings made in the minor mode, local, or global keymaps. The intent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 is that the character sequences that function keys send should not have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 command bindings in their own right.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 The value of @code{function-key-map} is usually set up automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 according to the terminal's Terminfo or Termcap entry, but sometimes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 those need help from terminal-specific Lisp files. XEmacs comes with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 terminal-specific files for many common terminals; their main purpose is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 to make entries in @code{function-key-map} beyond those that can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 deduced from Termcap and Terminfo. @xref{Terminal-Specific}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 Emacs versions 18 and earlier used totally different means of detecting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 the character sequences that represent function keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 @defvar key-translation-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 This variable is another keymap used just like @code{function-key-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 to translate input events into other events. It differs from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 @code{function-key-map} in two ways:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 @code{key-translation-map} goes to work after @code{function-key-map} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 finished; it receives the results of translation by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 @code{function-key-map}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 @code{key-translation-map} overrides actual key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 The intent of @code{key-translation-map} is for users to map one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 character set to another, including ordinary characters normally bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 to @code{self-insert-command}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 @cindex key translation function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 You can use @code{function-key-map} or @code{key-translation-map} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 more than simple aliases, by using a function, instead of a key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 sequence, as the ``translation'' of a key. Then this function is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 to compute the translation of that key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 The key translation function receives one argument, which is the prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 that was specified in @code{read-key-sequence}---or @code{nil} if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 key sequence is being read by the editor command loop. In most cases
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 you can ignore the prompt value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 If the function reads input itself, it can have the effect of altering
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 the event that follows. For example, here's how to define @kbd{C-c h}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 to turn the character that follows into a Hyper character:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (defun hyperify (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (let ((e (read-event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (vector (if (numberp e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (logior (lsh 1 20) e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (if (memq 'hyper (event-modifiers e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (add-event-modifier "H-" e))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (defun add-event-modifier (string e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (let ((symbol (if (symbolp e) e (car e))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (setq symbol (intern (concat string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (symbol-name symbol))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (if (symbolp e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (cons symbol (cdr e)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (define-key function-key-map "\C-ch" 'hyperify)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 @pindex iso-transl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 @cindex Latin-1 character set (input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 @cindex ISO Latin-1 characters (input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 The @file{iso-transl} library uses this feature to provide a way of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 inputting non-ASCII Latin-1 characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 @node Recording Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 @subsection Recording Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 @defun recent-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 This function returns a vector containing the last 100 input events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 from the keyboard or mouse. All input events are included, whether or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 not they were used as parts of key sequences. Thus, you always get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 last 100 inputs, not counting keyboard macros. (Events from keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 macros are excluded because they are less interesting for debugging; it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 should be enough to see the events that invoked the macros.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 @deffn Command open-dribble-file filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 @cindex dribble file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 This function opens a @dfn{dribble file} named @var{filename}. When a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 dribble file is open, each input event from the keyboard or mouse (but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 not those from keyboard macros) is written in that file. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 non-character event is expressed using its printed representation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 surrounded by @samp{<@dots{}>}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 You close the dribble file by calling this function with an argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 of @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 This function is normally used to record the input necessary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 trigger an XEmacs bug, for the sake of a bug report.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (open-dribble-file "~/dribble")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 See also the @code{open-termscript} function (@pxref{Terminal Output}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 @node Terminal Output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 @section Terminal Output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 @cindex terminal output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 The terminal output functions send output to the terminal or keep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 track of output sent to the terminal. The function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 @code{device-baud-rate} tells you what XEmacs thinks is the output speed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 of the terminal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 @defun device-baud-rate &optional device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 This function's value is the output speed of the terminal associated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 with @var{device}, as far as XEmacs knows. @var{device} defaults to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 selected device (usually the only device) if omitted. Changing this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 value does not change the speed of actual data transmission, but the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 value is used for calculations such as padding. This value has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 effect for window-system devices. (This is different in FSF Emacs, where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 the baud rate also affects decisions about whether to scroll part of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 screen or repaint, even when using a window system.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 The value is measured in bits per second.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 XEmacs attempts to automatically initialize the baud rate by querying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 the terminal. If you are running across a network, however, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 different parts of the network work are at different baud rates, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 value returned by XEmacs may be different from the value used by your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 local terminal. Some network protocols communicate the local terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 speed to the remote machine, so that XEmacs and other programs can get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 the proper value, but others do not. If XEmacs has the wrong value, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 makes decisions that are less than optimal. To fix the problem, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 @code{set-device-baud-rate}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 @defun set-device-baud-rate &optional device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 This function sets the output speed of @var{device}. See
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 @code{device-baud-rate}. @var{device} defaults to the selected device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (usually the only device) if omitted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 @defun send-string-to-terminal char-or-string &optional stdout-p device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 This function sends @var{char-or-string} to the terminal without
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 alteration. Control characters in @var{char-or-string} have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 terminal-dependent effects.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 If @var{device} is @code{nil}, this function writes to XEmacs's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 stderr, or to stdout if @var{stdout-p} is non-@code{nil}. Otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 @var{device} should be a tty or stream device, and the function writes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 to the device's normal or error output, according to @var{stdout-p}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 One use of this function is to define function keys on terminals that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 have downloadable function key definitions. For example, this is how on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 certain terminals to define function key 4 to move forward four
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 characters (by transmitting the characters @kbd{C-u C-f} to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 computer):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 (send-string-to-terminal "\eF4\^U\^F")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 @deffn Command open-termscript filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 @cindex termscript file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 This function is used to open a @dfn{termscript file} that will record
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 all the characters sent by XEmacs to the terminal. (If there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 multiple tty or stream devices, all characters sent to all such devices
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 are recorded.) The funcion returns @code{nil}. Termscript files are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 useful for investigating problems where XEmacs garbles the screen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 problems that are due to incorrect Termcap entries or to undesirable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 settings of terminal options more often than to actual XEmacs bugs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 Once you are certain which characters were actually output, you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 determine reliably whether they correspond to the Termcap specifications
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 A @code{nil} value for @var{filename} stops recording terminal output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 See also @code{open-dribble-file} in @ref{Terminal Input}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (open-termscript "../junk/termscript")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 @ignore Not in XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 @node Special Keysyms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 @section System-Specific X11 Keysyms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 To define system-specific X11 keysyms, set the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 @code{system-key-alist}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 @defvar system-key-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 This variable's value should be an alist with one element for each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 system-specific keysym. An element has this form: @code{(@var{code}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 . @var{symbol})}, where @var{code} is the numeric keysym code (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 including the ``vendor specific'' bit, 1 << 28), and @var{symbol} is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 name for the function key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 For example @code{(168 . mute-acute)} defines a system-specific key used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 by HP X servers whose numeric code is (1 << 28) + 168.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 It is not a problem if the alist defines keysyms for other X servers, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 long as they don't conflict with the ones used by the X server actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 The variable is always local to the current X terminal and cannot be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 buffer-local. @xref{Multiple Displays}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 @node Flow Control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 @section Flow Control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 @cindex flow control characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 This section attempts to answer the question ``Why does XEmacs choose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 to use flow-control characters in its command character set?'' For a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 second view on this issue, read the comments on flow control in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 @file{emacs/INSTALL} file from the distribution; for help with Termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 entries and DEC terminal concentrators, see @file{emacs/etc/TERMS}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 @cindex @kbd{C-s}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 @cindex @kbd{C-q}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 At one time, most terminals did not need flow control, and none used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 @code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 @kbd{C-s} and @kbd{C-q} as command characters was uncontroversial.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 XEmacs, for economy of keystrokes and portability, used nearly all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 @sc{ASCII} control characters, with mnemonic meanings when possible;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 thus, @kbd{C-s} for search and @kbd{C-q} for quote.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 Later, some terminals were introduced which required these characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 for flow control. They were not very good terminals for full-screen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 editing, so XEmacs maintainers did not pay attention. In later years,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 flow control with @kbd{C-s} and @kbd{C-q} became widespread among
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 terminals, but by this time it was usually an option. And the majority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 of users, who can turn flow control off, were unwilling to switch to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 less mnemonic key bindings for the sake of flow control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 So which usage is ``right'', XEmacs's or that of some terminal and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 concentrator manufacturers? This question has no simple answer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 One reason why we are reluctant to cater to the problems caused by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 @kbd{C-s} and @kbd{C-q} is that they are gratuitous. There are other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 techniques (albeit less common in practice) for flow control that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 preserve transparency of the character stream. Note also that their use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 for flow control is not an official standard. Interestingly, on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 model 33 teletype with a paper tape punch (which is very old), @kbd{C-s}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 and @kbd{C-q} were sent by the computer to turn the punch on and off!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 As X servers and other window systems replace character-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 terminals, this problem is gradually being cured. For the mean time,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 XEmacs provides a convenient way of enabling flow control if you want it:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 call the function @code{enable-flow-control}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 @defun enable-flow-control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 This function enables use of @kbd{C-s} and @kbd{C-q} for output flow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 control, and provides the characters @kbd{C-\} and @kbd{C-^} as aliases
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 for them using @code{keyboard-translate-table} (@pxref{Translating Input}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 You can use the function @code{enable-flow-control-on} in your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 @file{.emacs} file to enable flow control automatically on certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 terminal types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 @defun enable-flow-control-on &rest termtypes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 This function enables flow control, and the aliases @kbd{C-\} and @kbd{C-^},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 if the terminal type is one of @var{termtypes}. For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 Here is how @code{enable-flow-control} does its job:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 @enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 @cindex @sc{cbreak}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 It sets @sc{cbreak} mode for terminal input, and tells the operating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 system to handle flow control, with @code{(set-input-mode nil t)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 It sets up @code{keyboard-translate-table} to translate @kbd{C-\} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 @kbd{C-^} into @kbd{C-s} and @kbd{C-q}. Except at its very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 lowest level, XEmacs never knows that the characters typed were anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 but @kbd{C-s} and @kbd{C-q}, so you can in effect type them as @kbd{C-\}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 and @kbd{C-^} even when they are input for other commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 @xref{Translating Input}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 @end enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 If the terminal is the source of the flow control characters, then once
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 you enable kernel flow control handling, you probably can make do with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 less padding than normal for that terminal. You can reduce the amount
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 of padding by customizing the Termcap entry. You can also reduce it by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 setting @code{baud-rate} to a smaller value so that XEmacs uses a smaller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 speed when calculating the padding needed. @xref{Terminal Output}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 @node Batch Mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 @section Batch Mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 @cindex batch mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 @cindex noninteractive use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 The command line option @samp{-batch} causes XEmacs to run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 noninteractively. In this mode, XEmacs does not read commands from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 terminal, it does not alter the terminal modes, and it does not expect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 to be outputting to an erasable screen. The idea is that you specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 Lisp programs to run; when they are finished, XEmacs should exit. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 way to specify the programs to run is with @samp{-l @var{file}}, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 loads the library named @var{file}, and @samp{-f @var{function}}, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 calls @var{function} with no arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 Any Lisp program output that would normally go to the echo area,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 either using @code{message} or using @code{prin1}, etc., with @code{t}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 as the stream, goes instead to XEmacs's standard error descriptor when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 in batch mode. Thus, XEmacs behaves much like a noninteractive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 application program. (The echo area output that XEmacs itself normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 generates, such as command echoing, is suppressed entirely.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 @defun noninteractive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 This function returns non-@code{nil} when XEmacs is running in batch mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 @defvar noninteractive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 This variable is non-@code{nil} when XEmacs is running in batch mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 Setting this variable to @code{nil}, however, will not change whether
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 XEmacs is running in batch mode, and will not change the return value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 of the @code{noninteractive} function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 @end defvar