*** empty log message ***
[bpt/emacs.git] / man / cmdargs.texi
CommitLineData
6bf7aab6 1@c This is part of the Emacs manual.
739a80b3 2@c Copyright (C) 1985,86,87,93,94,95,1997,2001 Free Software Foundation, Inc.
6bf7aab6 3@c See file emacs.texi for copying conditions.
21af0bfa 4@node Command Arguments, X Resources, Service, Top
6bf7aab6
DL
5@appendix Command Line Arguments
6@cindex command line arguments
7@cindex arguments (command line)
8@cindex options (command line)
9@cindex switches (command line)
10@cindex startup (command line arguments)
11
12 GNU Emacs supports command line arguments to request various actions
13when invoking Emacs. These are for compatibility with other editors and
14for sophisticated activities. We don't recommend using them for
15ordinary editing.
16
17 Arguments starting with @samp{-} are @dfn{options}. Other arguments
18specify files to visit. Emacs visits the specified files while it
515d3b4b
RS
19starts up. The last file name on your command line becomes the
20current buffer; the other files are also visited in other buffers. If
21there are two files, they are both displayed; otherwise the last file
22is displayed along with a buffer list that shows what other buffers
23there are. As with most programs, the special argument @samp{--} says
24that all subsequent arguments are file names, not options, even if
25they start with @samp{-}.
6bf7aab6
DL
26
27 Emacs command options can specify many things, such as the size and
28position of the X window Emacs uses, its colors, and so on. A few
29options support advanced usage, such as running Lisp functions on files
30in batch mode. The sections of this chapter describe the available
31options, arranged according to their purpose.
32
33 There are two ways of writing options: the short forms that start with
34a single @samp{-}, and the long forms that start with @samp{--}. For
35example, @samp{-d} is a short form and @samp{--display} is the
36corresponding long form.
37
38 The long forms with @samp{--} are easier to remember, but longer to
39type. However, you don't have to spell out the whole option name; any
40unambiguous abbreviation is enough. When a long option takes an
41argument, you can use either a space or an equal sign to separate the
42option name and the argument. Thus, you can write either
43@samp{--display sugar-bombs:0.0} or @samp{--display=sugar-bombs:0.0}.
44We recommend an equal sign because it makes the relationship clearer,
45and the tables below always show an equal sign.
46
47@cindex initial options (command line)
48@cindex action options (command line)
49 Most options specify how to initialize Emacs, or set parameters for
50the Emacs session. We call them @dfn{initial options}. A few options
51specify things to do: for example, load libraries, call functions, or
0ec1f115 52terminate Emacs. These are called @dfn{action options}. These and file
6bf7aab6
DL
53names together are called @dfn{action arguments}. Emacs processes all
54the action arguments in the order they are written.
55
56@menu
57* Action Arguments:: Arguments to visit files, load libraries,
58 and call functions.
59* Initial Options:: Arguments that take effect while starting Emacs.
60* Command Example:: Examples of using command line arguments.
61* Resume Arguments:: Specifying arguments when you resume a running Emacs.
62* Environment:: Environment variables that Emacs uses.
e428626a
RS
63* Display X:: Changing the default display and using remote login.
64* Font X:: Choosing a font for text, under X.
e15044ea 65* Colors:: Choosing display colors.
e428626a
RS
66* Window Size X:: Start-up window size, under X.
67* Borders X:: Internal and external borders, under X.
68* Title X:: Specifying the initial frame's title.
69* Icons X:: Choosing what sort of icon to use, under X.
6bf7aab6
DL
70@end menu
71
72@node Action Arguments
73@appendixsec Action Arguments
74
75 Here is a table of the action arguments and options:
76
77@table @samp
78@item @var{file}
a8575fe5 79@opindex --visit
ec22060b 80@itemx --visit=@var{file}
a8575fe5 81@opindex --file
ec22060b 82@itemx --file=@var{file}
a8575fe5 83@cindex visiting files, command-line argument
6da55907 84@vindex inhibit-startup-buffer-menu
6bf7aab6 85Visit @var{file} using @code{find-file}. @xref{Visiting}.
6da55907
RS
86If you visit several files at startup in this way, Emacs
87also displays a Buffer Menu buffer to show you what files it
88has visited. You can inhibit that by setting @code{inhibit-startup-buffer-menu} to @code{t}.
6bf7aab6
DL
89
90@item +@var{linenum} @var{file}
a8575fe5 91@opindex +@var{linenum}
6bf7aab6
DL
92Visit @var{file} using @code{find-file}, then go to line number
93@var{linenum} in it.
94
660872b6 95@item +@var{linenum}:@var{columnnum} @var{file}
660872b6 96Visit @var{file} using @code{find-file}, then go to line number
0ec1f115 97@var{linenum} and put point at column number @var{columnnum}.
660872b6 98
6bf7aab6
DL
99@need 3000
100@item -l @var{file}
a8575fe5 101@opindex -l
6bf7aab6 102@itemx --load=@var{file}
a8575fe5
EZ
103@opindex --load
104@cindex loading Lisp libraries, command-line argument
6bf7aab6
DL
105Load a Lisp library named @var{file} with the function @code{load}.
106@xref{Lisp Libraries}. The library can be found either in the current
107directory, or in the Emacs library search path as specified
60a96371 108with @env{EMACSLOADPATH} (@pxref{General Variables}).
6bf7aab6
DL
109
110@item -f @var{function}
a8575fe5 111@opindex -f
6bf7aab6 112@itemx --funcall=@var{function}
a8575fe5
EZ
113@opindex --funcall
114@cindex call Lisp functions, command-line argument
6bf7aab6
DL
115Call Lisp function @var{function} with no arguments.
116
ec22060b 117@item --eval=@var{expression}
a8575fe5 118@opindex --eval
ec22060b 119@itemx --execute=@var{expression}
a8575fe5
EZ
120@opindex --execute
121@cindex evaluate expression, command-line argument
6bf7aab6
DL
122Evaluate Lisp expression @var{expression}.
123
124@item --insert=@var{file}
a8575fe5
EZ
125@opindex --insert
126@cindex insert file contents, command-line argument
6bf7aab6
DL
127Insert the contents of @var{file} into the current buffer. This is like
128what @kbd{M-x insert-file} does. @xref{Misc File Ops}.
129
130@item --kill
a8575fe5 131@opindex --kill
6bf7aab6
DL
132Exit from Emacs without asking for confirmation.
133@end table
134
135@vindex command-line-args
136 The init file can access the values of the action arguments as the
137elements of a list in the variable @code{command-line-args}. The init
138file can override the normal processing of the action arguments, or
139define new ones, by reading and setting this variable.
140
141@node Initial Options
142@appendixsec Initial Options
143
144 The initial options specify parameters for the Emacs session. This
145section describes the more general initial options; some other options
97878c08
EZ
146specifically related to the X Window System appear in the following
147sections.
6bf7aab6
DL
148
149 Some initial options affect the loading of init files. The normal
150actions of Emacs are to first load @file{site-start.el} if it exists,
151then your own init file @file{~/.emacs} if it exists, and finally
152@file{default.el} if it exists; certain options prevent loading of some
153of these files or substitute other files for them.
154
155@table @samp
156@item -t @var{device}
a8575fe5 157@opindex -t
6bf7aab6 158@itemx --terminal=@var{device}
a8575fe5
EZ
159@opindex --terminal
160@cindex device for Emacs terminal I/O
6bf7aab6
DL
161Use @var{device} as the device for terminal input and output.
162
163@item -d @var{display}
a8575fe5 164@opindex -d
6bf7aab6 165@itemx --display=@var{display}
a8575fe5
EZ
166@opindex --display
167@cindex display for Emacs frame
6bf7aab6 168Use the X Window System and use the display named @var{display} to open
a8575fe5 169the initial Emacs frame. @xref{Display X}, for more details.
6bf7aab6
DL
170
171@item -nw
a8575fe5 172@opindex -nw
011185fb
PJ
173@itemx --no-window-system
174@opindex --no-window-system
a8575fe5 175@cindex disable window system
54e33bb3 176Don't communicate directly with the window system, disregarding the
17e9a80b
RS
177@env{DISPLAY} environment variable even if it is set. This means that
178Emacs uses the terminal from which it was launched for all its display
179and input.
6bf7aab6
DL
180
181@need 3000
182@cindex batch mode
183@item -batch
a8575fe5 184@opindex --batch
6bf7aab6
DL
185@itemx --batch
186Run Emacs in @dfn{batch mode}, which means that the text being edited is
187not displayed and the standard terminal interrupt characters such as
188@kbd{C-z} and @kbd{C-c} continue to have their normal effect. Emacs in
1ba2ce68 189batch mode outputs to @code{stderr} only what would normally be displayed
741c4ff9
DL
190in the echo area under program control, and functions which would
191normally read from the minibuffer take their input from @code{stdin}.
6bf7aab6
DL
192
193Batch mode is used for running programs written in Emacs Lisp from
194shell scripts, makefiles, and so on. Normally the @samp{-l} option
195or @samp{-f} option will be used as well, to invoke a Lisp program
196to do the batch processing.
197
0ec1f115
RS
198@samp{-batch} implies @samp{-q} (do not load an init file). It also
199causes Emacs to exit after processing all the command options. In
200addition, it disables auto-saving except in buffers for which it has
201been explicitly requested.
6bf7aab6
DL
202
203@item -q
a8575fe5 204@opindex -q
6bf7aab6 205@itemx --no-init-file
a8575fe5
EZ
206@opindex --no-init-file
207@cindex bypassing init and site-start file
208@cindex init file, not loading
3b703ce9 209@cindex @file{default.el} file, not loading
6bf7aab6 210Do not load your Emacs init file @file{~/.emacs}, or @file{default.el}
21742660 211either. When invoked like this, Emacs does not allow saving options
00e50428
EZ
212changed with the @kbd{M-x customize} command and its variants.
213@xref{Easy Customization}.
6bf7aab6
DL
214
215@item --no-site-file
a8575fe5 216@opindex --no-site-file
3b703ce9 217@cindex @file{site-start.el} file, not loading
6bf7aab6
DL
218Do not load @file{site-start.el}. The options @samp{-q}, @samp{-u}
219and @samp{-batch} have no effect on the loading of this file---this is
220the only option that blocks it.
221
f6a9d2d8
CW
222@item --no-splash
223@opindex --no-splash
908abdfd 224@vindex inhibit-startup-message
6da55907
RS
225Do not display a splash screen on startup; this is equivalent to
226setting the variable @code{inhibit-startup-message} to non-@code{nil}.
908abdfd 227
6bf7aab6 228@item -u @var{user}
a8575fe5 229@opindex -u
6bf7aab6 230@itemx --user=@var{user}
a8575fe5
EZ
231@opindex --user
232@cindex load init file of another user
6bf7aab6
DL
233Load @var{user}'s Emacs init file @file{~@var{user}/.emacs} instead of
234your own.
235
236@item --debug-init
a8575fe5
EZ
237@opindex --debug-init
238@cindex errors in init file
6bf7aab6
DL
239Enable the Emacs Lisp debugger for errors in the init file.
240
241@item --unibyte
a8575fe5 242@opindex --unibyte
56bfaffd 243@cindex unibyte operation, command-line argument
1a1b17bc 244Do almost everything with single-byte buffers and strings.
6bf7aab6 245All buffers and strings are unibyte unless you (or a Lisp program)
4b1ad19a
RS
246explicitly ask for a multibyte buffer or string. (Note that Emacs
247always loads Lisp files in multibyte mode, even if @samp{--unibyte} is
248specified; see @ref{Enabling Multibyte}.) Setting the environment
249variable @env{EMACS_UNIBYTE} has the same effect.
6bf7aab6
DL
250
251@item --multibyte
a8575fe5 252@opindex --multibyte
60a96371 253Inhibit the effect of @env{EMACS_UNIBYTE}, so that Emacs
6bf7aab6
DL
254uses multibyte characters by default, as usual.
255@end table
256
257@node Command Example
258@appendixsec Command Argument Example
259
260 Here is an example of using Emacs with arguments and options. It
261assumes you have a Lisp program file called @file{hack-c.el} which, when
262loaded, performs some useful operation on the current buffer, expected
263to be a C program.
264
265@example
266emacs -batch foo.c -l hack-c -f save-buffer >& log
267@end example
268
269@noindent
270This says to visit @file{foo.c}, load @file{hack-c.el} (which makes
271changes in the visited file), save @file{foo.c} (note that
272@code{save-buffer} is the function that @kbd{C-x C-s} is bound to), and
273then exit back to the shell (because of @samp{-batch}). @samp{-batch}
274also guarantees there will be no problem redirecting output to
275@file{log}, because Emacs will not assume that it has a display terminal
276to work with.
277
278@node Resume Arguments
279@appendixsec Resuming Emacs with Arguments
280
281 You can specify action arguments for Emacs when you resume it after
282a suspension. To prepare for this, put the following code in your
283@file{.emacs} file (@pxref{Hooks}):
284
515d3b4b 285@c `resume-suspend-hook' is correct. It is the name of a function.
6bf7aab6
DL
286@example
287(add-hook 'suspend-hook 'resume-suspend-hook)
288(add-hook 'suspend-resume-hook 'resume-process-args)
289@end example
290
291 As further preparation, you must execute the shell script
515d3b4b
RS
292@file{emacs.csh} (if you use csh as your shell) or @file{emacs.bash}
293(if you use bash as your shell). These scripts define an alias named
6bf7aab6 294@code{edit}, which will resume Emacs giving it new command line
515d3b4b
RS
295arguments such as files to visit. The scripts are found in the
296@file{etc} subdirectory of the Emacs distribution.
6bf7aab6
DL
297
298 Only action arguments work properly when you resume Emacs. Initial
299arguments are not recognized---it's too late to execute them anyway.
300
301 Note that resuming Emacs (with or without arguments) must be done from
302within the shell that is the parent of the Emacs job. This is why
303@code{edit} is an alias rather than a program or a shell script. It is
304not possible to implement a resumption command that could be run from
1a1b17bc
EZ
305other subjobs of the shell; there is no way to define a command that could
306be made the value of @env{EDITOR}, for example. Therefore, this feature
6bf7aab6
DL
307does not take the place of the Emacs Server feature (@pxref{Emacs
308Server}).
309
310 The aliases use the Emacs Server feature if you appear to have a
311server Emacs running. However, they cannot determine this with complete
312accuracy. They may think that a server is still running when in
313actuality you have killed that Emacs, because the file
515d3b4b 314@file{/tmp/esrv@dots{}} still exists. If this happens, find that
6bf7aab6
DL
315file and delete it.
316
317@node Environment
318@appendixsec Environment Variables
319@cindex environment variables
320
4b1ad19a
RS
321 The @dfn{environment} is a feature of the operating system; it
322consists of a collection of variables with names and values. Each
323variable is called an @dfn{environment variable}; environment variable
324names are case-sensitive, and it is conventional to use upper case
325letters only. The values are all text strings.
6bf7aab6 326
4b1ad19a
RS
327 What makes the environment useful is that subprocesses inherit the
328environment automatically from their parent process. This means you
329can set up an environment variable in your login shell, and all the
330programs you run (including Emacs) will automatically see it.
331Subprocesses of Emacs (such as shells, compilers, and version-control
332software) inherit the environment from Emacs, too.
333
334@findex setenv
335@findex getenv
336 Inside Emacs, the command @kbd{M-x getenv} gets the value of an
337environment variable. @kbd{M-x setenv} sets a variable in the Emacs
338environment. The way to set environment variables outside of Emacs
339depends on the operating system, and especially the shell that you are
340using. For example, here's how to set the environment variable
341@env{ORGANIZATION} to @samp{not very much} using Bash:
6bf7aab6
DL
342
343@example
344export ORGANIZATION="not very much"
345@end example
346
347@noindent
348and here's how to do it in csh or tcsh:
349
350@example
351setenv ORGANIZATION "not very much"
352@end example
353
afcca90b 354 When Emacs uses the X Window System, it inherits the use
4b1ad19a 355of a large number of environment variables from the X libraries. See
6bf7aab6
DL
356the X documentation for more information.
357
358@menu
359* General Variables:: Environment variables that all versions of Emacs use.
360* Misc Variables:: Certain system-specific variables.
afcca90b 361* MS-Windows Registry:: An alternative to the environment on MS-Windows.
6bf7aab6
DL
362@end menu
363
364@node General Variables
365@appendixsubsec General Variables
366
4b1ad19a
RS
367 Here is an alphabetical list of specific environment variables that
368have special meanings in Emacs, giving the name of each variable and
369its meaning. Most of these variables are also used by some other
370programs. Emacs does not require any of these environment variables
371to be set, but it uses their values if they are set.
372
60a96371 373@table @env
f51e949c 374@item CDPATH
6bf7aab6
DL
375Used by the @code{cd} command to search for the directory you specify,
376when you specify a relative directory name.
6bf7aab6 377@item EMACS_UNIBYTE
56bfaffd 378@cindex unibyte operation, environment variable
4b1ad19a
RS
379Defining this environment variable with a nonempty value directs Emacs
380to do almost everything with single-byte buffers and strings. It is
381equivalent to using the @samp{--unibyte} command-line option on each
382invocation. @xref{Initial Options}.
6bf7aab6 383@item EMACSDATA
4b1ad19a
RS
384Directory for the architecture-independent files that come with Emacs.
385This is used to initialize the Lisp variable @code{data-directory}.
18a349f5 386@item EMACSDOC
4b1ad19a
RS
387Directory for the documentation string file,
388@file{DOC-@var{emacsversion}}. This is used to initialize the Lisp
b389557a 389variable @code{doc-directory}.
6bf7aab6 390@item EMACSLOADPATH
5d9b65e0
EZ
391A colon-separated list of directories@footnote{
392Here and below, whenever we say ``colon-separated list of directories'',
393it pertains to Unix and GNU/Linux systems. On MS-DOS and MS-Windows,
394the directories are separated by semi-colons instead, since DOS/Windows
395file names might include a colon after a drive letter.}
396to search for Emacs Lisp files---used to initialize @code{load-path}.
6bf7aab6 397@item EMACSPATH
4b1ad19a
RS
398A colon-separated list of directories to search for executable
399files---used to initialize @code{exec-path}.
6bf7aab6 400@item ESHELL
60a96371 401Used for shell-mode to override the @env{SHELL} environment variable.
6bf7aab6
DL
402@item HISTFILE
403The name of the file that shell commands are saved in between logins.
ec22060b
EZ
404This variable defaults to @file{~/.bash_history} if you use Bash, to
405@file{~/.sh_history} if you use ksh, and to @file{~/.history}
406otherwise.
6bf7aab6
DL
407@item HOME
408The location of the user's files in the directory tree; used for
409expansion of file names starting with a tilde (@file{~}). On MS-DOS, it
410defaults to the directory from which Emacs was started, with @samp{/bin}
71d0aa0c 411removed from the end if it was present. On Windows, the default value
afcca90b 412of @env{HOME} is @file{C:/}, the root directory of drive @file{C:}.
6bf7aab6
DL
413@item HOSTNAME
414The name of the machine that Emacs is running on.
415@item INCPATH
416A colon-separated list of directories. Used by the @code{complete} package
417to search for files.
418@item INFOPATH
b389557a 419A colon-separated list of directories in which to search for Info files.
fbc164de 420@item LC_ALL
9c6251b6 421@itemx LC_COLLATE
6bf7aab6 422@itemx LC_CTYPE
9c6251b6
EZ
423@itemx LC_MESSAGES
424@itemx LC_MONETARY
425@itemx LC_NUMERIC
426@itemx LC_TIME
fbc164de 427@itemx LANG
9c6251b6
EZ
428The user's preferred locale. The locale has six categories, specified
429by the environment variables @env{LC_COLLATE} for sorting,
430@env{LC_CTYPE} for character encoding, @env{LC_MESSAGES} for system
431messages, @env{LC_MONETARY} for monetary formats, @env{LC_NUMERIC} for
432numbers, and @env{LC_TIME} for dates and times. If one of these
433variables is not set, the category defaults to the value of the
434@env{LANG} environment variable, or to the default @samp{C} locale if
435@env{LANG} is not set. But if @env{LC_ALL} is specified, it overrides
436the settings of all the other locale environment variables.
437
afcca90b
JR
438On MS-Windows, if @env{LANG} is not already set in the environment
439when Emacs starts, Emacs sets it based on the system-wide default
440language, which you can set in the @samp{Regional Settings} Control Panel
441on some versions of MS-Windows.
442
443The value of the @env{LC_CTYPE} category is
4b1ad19a 444matched against entries in @code{locale-language-names},
fbc164de 445@code{locale-charset-language-names}, and
4b1ad19a
RS
446@code{locale-preferred-coding-systems}, to select a default language
447environment and coding system. @xref{Language Environments}.
6bf7aab6 448@item LOGNAME
60a96371 449The user's login name. See also @env{USER}.
6bf7aab6
DL
450@item MAIL
451The name of the user's system mail inbox.
452@item MAILRC
4b1ad19a
RS
453Name of file containing mail aliases. (The default is
454@file{~/.mailrc}.)
6bf7aab6 455@item MH
4b1ad19a 456Name of setup file for the mh system. (The default is @file{~/.mh_profile}.)
6bf7aab6
DL
457@item NAME
458The real-world name of the user.
459@item NNTPSERVER
5937ea41 460The name of the news server. Used by the mh and Gnus packages.
6bf7aab6
DL
461@item ORGANIZATION
462The name of the organization to which you belong. Used for setting the
5937ea41 463`Organization:' header in your posts from the Gnus package.
6bf7aab6 464@item PATH
5d9b65e0
EZ
465A colon-separated list of directories in which executables reside. This
466is used to initialize the Emacs Lisp variable @code{exec-path}.
6bf7aab6
DL
467@item PWD
468If set, this should be the default directory when Emacs was started.
469@item REPLYTO
470If set, this specifies an initial value for the variable
471@code{mail-default-reply-to}. @xref{Mail Headers}.
472@item SAVEDIR
473The name of a directory in which news articles are saved by default.
5937ea41 474Used by the Gnus package.
6bf7aab6
DL
475@item SHELL
476The name of an interpreter used to parse and execute programs run from
477inside Emacs.
afcca90b 478@cindex background mode, on @command{xterm}
6bf7aab6 479@item TERM
0ec1f115 480The type of the terminal that Emacs is using. This variable must be
6bf7aab6
DL
481set unless Emacs is run in batch mode. On MS-DOS, it defaults to
482@samp{internal}, which specifies a built-in terminal emulation that
b370b3b0 483handles the machine's own display. If the value of @env{TERM} indicates
afcca90b 484that Emacs runs in non-windowed mode from @command{xterm} or a similar
b370b3b0
EZ
485terminal emulator, the background mode defaults to @samp{light}, and
486Emacs will choose colors that are appropriate for a light background.
6bf7aab6
DL
487@item TERMCAP
488The name of the termcap library file describing how to program the
60a96371 489terminal specified by the @env{TERM} variable. This defaults to
6bf7aab6
DL
490@file{/etc/termcap}.
491@item TMPDIR
492Used by the Emerge package as a prefix for temporary files.
493@item TZ
94c3309f 494This specifies the current time zone and possibly also daylight
afcca90b 495saving time information. On MS-DOS, if @env{TZ} is not set in the
94c3309f 496environment when Emacs starts, Emacs defines a default value as
9c3aede4 497appropriate for the country code returned by DOS. On MS-Windows, Emacs
afcca90b 498does not use @env{TZ} at all.
6bf7aab6 499@item USER
60a96371 500The user's login name. See also @env{LOGNAME}. On MS-DOS, this
6bf7aab6
DL
501defaults to @samp{root}.
502@item VERSION_CONTROL
503Used to initialize the @code{version-control} variable (@pxref{Backup
504Names}).
505@end table
506
507@node Misc Variables
508@appendixsubsec Miscellaneous Variables
509
510These variables are used only on particular configurations:
511
60a96371 512@table @env
6bf7aab6 513@item COMSPEC
ec22060b
EZ
514On MS-DOS and MS-Windows, the name of the command interpreter to use
515when invoking batch files and commands internal to the shell. On MS-DOS
516this is also used to make a default value for the @env{SHELL} environment
517variable.
6bf7aab6
DL
518
519@item NAME
60a96371 520On MS-DOS, this variable defaults to the value of the @env{USER}
6bf7aab6
DL
521variable.
522
523@item TEMP
524@itemx TMP
ec22060b
EZ
525On MS-DOS and MS-Windows, these specify the name of the directory for
526storing temporary files in.
6bf7aab6
DL
527
528@item EMACSTEST
529On MS-DOS, this specifies a file to use to log the operation of the
530internal terminal emulator. This feature is useful for submitting bug
531reports.
532
533@item EMACSCOLORS
9c3aede4
RS
534On MS-DOS, this specifies the screen colors. It is useful to set them
535this way, since otherwise Emacs would display the default colors
536momentarily when it starts up.
537
538The value of this variable should be the two-character encoding of the
6bf7aab6
DL
539foreground (the first character) and the background (the second
540character) colors of the default face. Each character should be the
541hexadecimal code for the desired color on a standard PC text-mode
47d7776c 542display. For example, to get blue text on a light gray background,
ed50f966 543specify @samp{EMACSCOLORS=17}, since 1 is the code of the blue color and
47d7776c 5447 is the code of the light gray color.
6bf7aab6
DL
545
546The PC display usually supports only eight background colors. However,
547Emacs switches the DOS display to a mode where all 16 colors can be used
548for the background, so all four bits of the background color are
549actually used.
550
551@item WINDOW_GFX
552Used when initializing the Sun windows system.
afcca90b
JR
553
554@item PRELOAD_WINSOCK
555On MS-Windows, if you set this variable, Emacs will load and initialize
556the network library at startup, instead of waiting until the first
557time it is required.
558
559@item emacs_dir
560On MS-Windows, @env{emacs_dir} is a special environment variable, which
561indicates the full path of the directory in which Emacs is installed.
562If Emacs is installed in the standard directory structure, it
563calculates this value automatically. It is not much use setting this
564variable yourself unless your installation is non-standard, since
565unlike other environment variables, it will be overridden by Emacs at
566startup. When setting other environment variables, such as
567@env{EMACSLOADPATH}, you may find it useful to use @env{emacs_dir}
568rather than hard-coding an absolute path. This allows multiple
569versions of Emacs to share the same environment variable settings, and
570it allows you to move the Emacs installation directory, without
571changing any environment or registry settings.
6bf7aab6 572@end table
e428626a 573
afcca90b
JR
574@node MS-Windows Registry
575@appendixsubsec The MS-Windows System Registry
576@pindex addpm, MS-Windows installation program
577@cindex registry, setting environment variables and resources on MS-Windows
578
579On MS-Windows, the installation program @command{addpm.exe} adds values
580for @env{emacs_dir}, @env{EMACSLOADPATH}, @env{EMACSDATA},
581@env{EMACSPATH}, @env{EMACSDOC}, @env{SHELL} and @env{TERM} to the
582@file{HKEY_LOCAL_MACHINE} section of the system registry, under
583@file{/Software/GNU/Emacs}. It does this because there is no standard
584place to set environment variables across different versions of
585Windows. Running @command{addpm.exe} is no longer strictly
586necessary in recent versions of Emacs, but if you are upgrading from
587an older version, running @command{addpm.exe} ensures that you do not have
588older registry entries from a previous installation, which may not be
589compatible with the latest version of Emacs.
590
591When Emacs starts, as well as checking the environment, it also checks
592the System Registry for those variables and for @env{HOME}, @env{LANG}
593and @env{PRELOAD_WINSOCK}.
594
595To determine the value of those variables, Emacs goes through the
596following procedure. First, the environment is checked. If the
597variable is not found there, Emacs looks for registry keys by that
598name under @file{/Software/GNU/Emacs}; first in the
599@file{HKEY_CURRENT_USER} section of the registry, and if not found
600there, in the @file{HKEY_LOCAL_MACHINE} section. Finally, if Emacs
601still cannot determine the values, compiled-in defaults are used.
602
603In addition to the environment variables above, you can also add many
604of the settings which on X belong in the @file{.Xdefaults} file
605(@pxref{X Resources}) to the @file{/Software/GNU/Emacs} registry key.
606Settings you add to the @file{HKEY_LOCAL_MACHINE} section will affect
607all users of the machine. Settings you add to the
608@file{HKEY_CURRENT_USER} section will only affect you, and will
609override machine wide settings.
610
e428626a
RS
611@node Display X
612@appendixsec Specifying the Display Name
613@cindex display name (X Window System)
614@cindex @env{DISPLAY} environment variable
615
616 The environment variable @env{DISPLAY} tells all X clients, including
617Emacs, where to display their windows. Its value is set by default
618in ordinary circumstances, when you start an X server and run jobs
619locally. Occasionally you may need to specify the display yourself; for
620example, if you do a remote login and want to run a client program
621remotely, displaying on your local screen.
622
623 With Emacs, the main reason people change the default display is to
624let them log into another system, run Emacs on that system, but have the
625window displayed at their local terminal. You might need to log in
626to another system because the files you want to edit are there, or
627because the Emacs executable file you want to run is there.
628
629 The syntax of the @env{DISPLAY} environment variable is
630@samp{@var{host}:@var{display}.@var{screen}}, where @var{host} is the
631host name of the X Window System server machine, @var{display} is an
632arbitrarily-assigned number that distinguishes your server (X terminal)
633from other servers on the same machine, and @var{screen} is a
634rarely-used field that allows an X server to control multiple terminal
635screens. The period and the @var{screen} field are optional. If
636included, @var{screen} is usually zero.
637
638 For example, if your host is named @samp{glasperle} and your server is
639the first (or perhaps the only) server listed in the configuration, your
640@env{DISPLAY} is @samp{glasperle:0.0}.
641
642 You can specify the display name explicitly when you run Emacs, either
643by changing the @env{DISPLAY} variable, or with the option @samp{-d
644@var{display}} or @samp{--display=@var{display}}. Here is an example:
645
646@smallexample
647emacs --display=glasperle:0 &
648@end smallexample
649
650 You can inhibit the direct use of the window system and GUI with the
651@samp{-nw} option. It tells Emacs to display using ordinary ASCII on
652its controlling terminal. This is also an initial option.
653
654 Sometimes, security arrangements prevent a program on a remote system
655from displaying on your local system. In this case, trying to run Emacs
656produces messages like this:
657
658@smallexample
659Xlib: connection to "glasperle:0.0" refused by server
660@end smallexample
661
662@noindent
afcca90b 663You might be able to overcome this problem by using the @command{xhost}
e428626a
RS
664command on the local system to give permission for access from your
665remote machine.
666
667@node Font X
668@appendixsec Font Specification Options
669@cindex font name (X Window System)
670
671 By default, Emacs displays text in the font named @samp{9x15}, which
672makes each character nine pixels wide and fifteen pixels high. You can
673specify a different font on your command line through the option
674@samp{-fn @var{name}} (or @samp{--font}, which is an alias for
675@samp{-fn}).
676
677@table @samp
678@item -fn @var{name}
679@opindex -fn
680@itemx --font=@var{name}
681@opindex --font
682@cindex specify default font from the command line
683Use font @var{name} as the default font.
684@end table
685
686 Under X, each font has a long name which consists of eleven words or
687numbers, separated by dashes. Some fonts also have shorter
688nicknames---@samp{9x15} is such a nickname. You can use either kind of
689name. You can use wildcard patterns for the font name; then Emacs lets
690X choose one of the fonts that match the pattern. Here is an example,
691which happens to specify the font whose nickname is @samp{6x13}:
692
693@smallexample
eca274b1
RS
694emacs -fn \
695 "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1" &
e428626a
RS
696@end smallexample
697
698@noindent
699You can also specify the font in your @file{.Xdefaults} file:
700
701@smallexample
702emacs.font: -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
703@end smallexample
704
705 A long font name has the following form:
706
707@smallexample
708-@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
709@dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{charset}
710@end smallexample
711
712@table @var
713@item maker
714This is the name of the font manufacturer.
715@item family
716This is the name of the font family---for example, @samp{courier}.
717@item weight
718This is normally @samp{bold}, @samp{medium} or @samp{light}. Other
719words may appear here in some font names.
720@item slant
721This is @samp{r} (roman), @samp{i} (italic), @samp{o} (oblique),
722@samp{ri} (reverse italic), or @samp{ot} (other).
723@item widthtype
724This is normally @samp{condensed}, @samp{extended}, @samp{semicondensed}
725or @samp{normal}. Other words may appear here in some font names.
726@item style
727This is an optional additional style name. Usually it is empty---most
728long font names have two hyphens in a row at this point.
729@item pixels
730This is the font height, in pixels.
731@item height
732This is the font height on the screen, measured in tenths of a printer's
733point---approximately 1/720 of an inch. In other words, it is the point
734size of the font, times ten. For a given vertical resolution,
735@var{height} and @var{pixels} are proportional; therefore, it is common
736to specify just one of them and use @samp{*} for the other.
737@item horiz
738This is the horizontal resolution, in pixels per inch, of the screen for
739which the font is intended.
740@item vert
741This is the vertical resolution, in pixels per inch, of the screen for
742which the font is intended. Normally the resolution of the fonts on
743your system is the right value for your screen; therefore, you normally
744specify @samp{*} for this and @var{horiz}.
745@item spacing
746This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
747(character cell).
748@item width
749This is the average character width, in pixels, multiplied by ten.
750@item charset
751This is the character set that the font depicts.
752Normally you should use @samp{iso8859-1}.
753@end table
754
755@cindex listing system fonts
756 You will probably want to use a fixed-width default font---that is,
757a font in which all characters have the same width. Any font with
758@samp{m} or @samp{c} in the @var{spacing} field of the long name is a
afcca90b 759fixed-width font. Here's how to use the @command{xlsfonts} program to
e428626a
RS
760list all the fixed-width fonts available on your system:
761
762@example
763xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
764xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
765xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
766@end example
767
768@noindent
afcca90b 769To see what a particular font looks like, use the @command{xfd} command.
e428626a
RS
770For example:
771
772@example
773xfd -fn 6x13
774@end example
775
776@noindent
777displays the entire font @samp{6x13}.
778
779 While running Emacs, you can set the font of the current frame
780(@pxref{Frame Parameters}) or for a specific kind of text
781(@pxref{Faces}).
782
e15044ea 783@node Colors
e428626a
RS
784@appendixsec Window Color Options
785@cindex color of window
786@cindex text colors, from command line
787
788@findex list-colors-display
789@cindex available colors
790 On a color display, you can specify which color to use for various
791parts of the Emacs display. To find out what colors are available on
792your system, type @kbd{M-x list-colors-display}, or press
793@kbd{C-Mouse-2} and select @samp{Display Colors} from the pop-up menu.
794If you do not specify colors, on windowed displays the default for the
795background is white and the default for all other colors is black. On a
796monochrome display, the foreground is black, the background is white,
797and the border is gray if the display supports that. On terminals, the
798background is usually black and the foreground is white.
799
800 Here is a list of the command-line options for specifying colors:
801
802@table @samp
803@item -fg @var{color}
804@opindex -fg
805@itemx --foreground-color=@var{color}
806@opindex --foreground-color
807@cindex foreground color, command-line argument
808Specify the foreground color. @var{color} should be a standard color
809name, or a numeric specification of the color's red, green, and blue
810components as in @samp{#4682B4} or @samp{RGB:46/82/B4}.
811@item -bg @var{color}
812@opindex -bg
813@itemx --background-color=@var{color}
814@opindex --background-color
815@cindex background color, command-line argument
816Specify the background color.
817@item -bd @var{color}
818@opindex -bd
819@itemx --border-color=@var{color}
820@opindex --border-color
821@cindex border color, command-line argument
822Specify the color of the border of the X window.
823@item -cr @var{color}
824@opindex -cr
825@itemx --cursor-color=@var{color}
826@opindex --cursor-color
827@cindex cursor color, command-line argument
828Specify the color of the Emacs cursor which indicates where point is.
829@item -ms @var{color}
830@opindex -ms
831@itemx --mouse-color=@var{color}
832@opindex --mouse-color
833@cindex mouse pointer color, command-line argument
834Specify the color for the mouse cursor when the mouse is in the Emacs window.
835@item -r
836@opindex -r
837@itemx -rv
838@opindex -rv
839@itemx --reverse-video
840@opindex --reverse-video
841@cindex reverse video, command-line argument
842Reverse video---swap the foreground and background colors.
e15044ea
EZ
843@item --color=@var{mode}
844@opindex --color
845@cindex standard colors on a character terminal
846For a character terminal only, specify the mode of color support. The
847parameter @var{mode} can be one of the following:
848@table @samp
849@item never
850@itemx no
851Don't use colors even if the terminal's capabilities specify color
852support.
853@item default
854@itemx auto
855Same as when @option{--color} is not used at all: Emacs detects at
856startup whether the terminal supports colors, and if it does, turns on
857colored display.
858@item always
859@itemx yes
860@itemx ansi8
861Turn on the color support unconditionally, and use color commands
862specified by the ANSI escape sequences for the 8 standard colors.
863@item @var{num}
864Use color mode for @var{num} colors. If @var{num} is -1, turn off
865color support (equivalent to @samp{never}); if it is 0, use the
866default color support for this terminal (equivalent to @samp{auto});
867otherwise use an appropriate standard mode for @var{num} colors. If
868there is no mode that supports @var{num} colors, Emacs acts as if
869@var{num} were 0, i.e.@: it uses the terminal's default color support
870mode.
871@end table
872If @var{mode} is omitted, it defaults to @var{ansi8}.
e428626a
RS
873@end table
874
875 For example, to use a coral mouse cursor and a slate blue text cursor,
876enter:
877
878@example
879emacs -ms coral -cr 'slate blue' &
880@end example
881
882 You can reverse the foreground and background colors through the
883@samp{-rv} option or with the X resource @samp{reverseVideo}.
884
885 The @samp{-fg}, @samp{-bg}, and @samp{-rv} options function on
886text-only terminals as well as on window systems.
887
888@node Window Size X
d7beb4c9 889@appendixsec Options for Window Size and Position
e428626a
RS
890@cindex geometry of Emacs window
891@cindex position and size of Emacs frame
892@cindex width and height of Emacs frame
d7beb4c9 893@cindex specifying fullscreen for Emacs frame
e428626a 894
d7beb4c9
EZ
895 Here is a list of the command-line options for specifying size and
896position of the initial Emacs frame:
e428626a
RS
897
898@table @samp
899@item -g @var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
900@opindex -g
901Specify window size @var{width} and @var{height} (measured in character
902columns and lines), and positions @var{xoffset} and @var{yoffset}
903(measured in pixels).
904
905@item --geometry=@var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
906@opindex --geometry
907This is another way of writing the same thing.
d7beb4c9
EZ
908
909@item -fs
910@opindex -fs
911@itemx --fullscreen
912@opindex --fullscreen
913@cindex fullscreen, command-line argument
914Specify that width and height shall be the size of the screen.
915
916@item -fh
917@opindex -fh
918@itemx --fullheight
919@opindex --fullheight
920@cindex fullheight, command-line argument
921Specify that the height shall be the height of the screen.
922
923@item -fw
924@opindex -fw
925@itemx --fullwidth
926@opindex --fullwidth
927@cindex fullwidth, command-line argument
928Specify that the width shall be the width of the screen.
e428626a
RS
929@end table
930
d7beb4c9 931
e428626a 932@noindent
d7beb4c9
EZ
933In the @samp{--geometry} option, @code{@r{@{}+-@r{@}}} means either a plus
934 sign or a minus sign. A plus
e428626a
RS
935sign before @var{xoffset} means it is the distance from the left side of
936the screen; a minus sign means it counts from the right side. A plus
937sign before @var{yoffset} means it is the distance from the top of the
938screen, and a minus sign there indicates the distance from the bottom.
939The values @var{xoffset} and @var{yoffset} may themselves be positive or
940negative, but that doesn't change their meaning, only their direction.
941
afcca90b 942 Emacs uses the same units as @command{xterm} does to interpret the geometry.
e428626a
RS
943The @var{width} and @var{height} are measured in characters, so a large font
944creates a larger frame than a small font. (If you specify a proportional
945font, Emacs uses its maximum bounds width as the width unit.) The
946@var{xoffset} and @var{yoffset} are measured in pixels.
947
948 Since the mode line and the echo area occupy the last 2 lines of the
949frame, the height of the initial text window is 2 less than the height
950specified in your geometry. In non-X-toolkit versions of Emacs, the
951menu bar also takes one line of the specified number. But in the X
952toolkit version, the menu bar is additional and does not count against
953the specified height. The tool bar, if present, is also additional.
954
955 You do not have to specify all of the fields in the geometry
956specification.
957
958 If you omit both @var{xoffset} and @var{yoffset}, the window manager
959decides where to put the Emacs frame, possibly by letting you place
960it with the mouse. For example, @samp{164x55} specifies a window 164
961columns wide, enough for two ordinary width windows side by side, and 55
962lines tall.
963
964 The default width for Emacs is 80 characters and the default height is
96540 lines. You can omit either the width or the height or both. If
966you start the geometry with an integer, Emacs interprets it as the
967width. If you start with an @samp{x} followed by an integer, Emacs
968interprets it as the height. Thus, @samp{81} specifies just the width;
969@samp{x45} specifies just the height.
970
971 If you start with @samp{+} or @samp{-}, that introduces an offset,
972which means both sizes are omitted. Thus, @samp{-3} specifies the
973@var{xoffset} only. (If you give just one offset, it is always
974@var{xoffset}.) @samp{+3-3} specifies both the @var{xoffset} and the
975@var{yoffset}, placing the frame near the bottom left of the screen.
976
977 You can specify a default for any or all of the fields in
978@file{.Xdefaults} file, and then override selected fields with a
979@samp{--geometry} option.
980
d7beb4c9
EZ
981
982 When using one of @samp{--fullscreen}, @samp{--fullwidth} or
983@samp{--fullheight} there may be some space around the frame
984anyway. That is because Emacs rounds the sizes so they are an
985even number of character heights and widths.
986
987 Some window managers have options that can make them ignore both
988program-specified and user-specified positions (sawfish is one).
989If these are set, Emacs fails to position the window correctly.
990
e428626a
RS
991@node Borders X
992@appendixsec Internal and External Borders
993@cindex borders (X Window System)
994
995 An Emacs frame has an internal border and an external border. The
996internal border is an extra strip of the background color around the
997text portion of the frame. Emacs itself draws the internal border.
998The external border is added by the window manager outside the frame;
999depending on the window manager you use, it may contain various boxes
1000you can click on to move or iconify the window.
1001
1002@table @samp
1003@item -ib @var{width}
1004@opindex -ib
1005@itemx --internal-border=@var{width}
1006@opindex --internal-border
1007@cindex border width, command-line argument
1008Specify @var{width} as the width of the internal border, in pixels.
1009
1010@item -bw @var{width}
1011@opindex -bw
1012@itemx --border-width=@var{width}
1013@opindex --border-width
1014Specify @var{width} as the width of the main border, in pixels.
1015@end table
1016
1017 When you specify the size of the frame, that does not count the
1018borders. The frame's position is measured from the outside edge of the
1019external border.
1020
1021 Use the @samp{-ib @var{n}} option to specify an internal border
1022@var{n} pixels wide. The default is 1. Use @samp{-bw @var{n}} to
1023specify the width of the external border (though the window manager may
1024not pay attention to what you specify). The default width of the
1025external border is 2.
1026
1027@node Title X
1028@appendixsec Frame Titles
1029
1030 An Emacs frame may or may not have a specified title. The frame
1031title, if specified, appears in window decorations and icons as the
1032name of the frame. If an Emacs frame has no specified title, the
1033default title has the form @samp{@var{invocation-name}@@@var{machine}}
1034(if there is only one frame) or the selected window's buffer name (if
1035there is more than one frame).
1036
1037 You can specify a title for the initial Emacs frame with a command
1038line option:
1039
1040@table @samp
1041@item -title @var{title}
1042@opindex --title
1043@itemx --title=@var{title}
1044@itemx -T @var{title}
1045@opindex -T
1046@cindex frame title, command-line argument
1047Specify @var{title} as the title for the initial Emacs frame.
1048@end table
1049
186e9bcc 1050 The @samp{--name} option (@pxref{Resources}) also specifies the title
e428626a
RS
1051for the initial Emacs frame.
1052
1053@node Icons X
1054@appendixsec Icons
1055@cindex icons (X Window System)
1056
1057 Most window managers allow the user to ``iconify'' a frame, removing
1058it from sight, and leaving a small, distinctive ``icon'' window in its
1059place. Clicking on the icon window makes the frame itself appear again.
1060If you have many clients running at once, you can avoid cluttering up
1061the screen by iconifying most of the clients.
1062
1063@table @samp
1064@item -i
1065@opindex -i
1066@itemx --icon-type
1067@opindex --icon-type
1068@cindex Emacs icon, a gnu
1069Use a picture of a gnu as the Emacs icon.
1070
1071@item -iconic
1072@opindex --iconic
1073@itemx --iconic
1074@cindex start iconified, command-line argument
1075Start Emacs in iconified state.
1076@end table
1077
1078 The @samp{-i} or @samp{--icon-type} option tells Emacs to use an icon
1079window containing a picture of the GNU gnu. If omitted, Emacs lets the
1080window manager choose what sort of icon to use---usually just a small
1081rectangle containing the frame's title.
1082
1083 The @samp{-iconic} option tells Emacs to begin running as an icon,
1084rather than showing a frame right away. In this situation, the icon
1085is the only indication that Emacs has started; the text frame doesn't
1086appear until you deiconify it.