Get rid of the INFO_EXT variable
[bpt/emacs.git] / doc / emacs / cmdargs.texi
CommitLineData
8cf51b2c 1@c This is part of the Emacs manual.
ba318903 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2014 Free Software
ab422c4d 3@c Foundation, Inc.
8cf51b2c 4@c See file emacs.texi for copying conditions.
abb9615e 5@node Emacs Invocation
8cf51b2c
GM
6@appendix Command Line Arguments for Emacs Invocation
7@cindex command line arguments
8@cindex arguments (command line)
9@cindex options (command line)
10@cindex switches (command line)
11@cindex startup (command line arguments)
12@cindex invocation (command line arguments)
4ae3802f 13@c FIXME: Document `--smid'? --xfq
8cf51b2c 14
63961e6a
CY
15 Emacs supports command line arguments to request various actions
16when invoking Emacs. These are for compatibility with other editors
17and for sophisticated activities. We don't recommend using them for
18ordinary editing (@xref{Emacs Server}, for a way to access an existing
19Emacs job from the command line).
8cf51b2c
GM
20
21 Arguments starting with @samp{-} are @dfn{options}, and so is
22@samp{+@var{linenum}}. All other arguments specify files to visit.
23Emacs visits the specified files while it starts up. The last file
63961e6a
CY
24specified on the command line becomes the current buffer; the other
25files are also visited in other buffers. As with most programs, the
26special argument @samp{--} says that all subsequent arguments are file
27names, not options, even if they start with @samp{-}.
8cf51b2c
GM
28
29 Emacs command options can specify many things, such as the size and
30position of the X window Emacs uses, its colors, and so on. A few
31options support advanced usage, such as running Lisp functions on files
32in batch mode. The sections of this chapter describe the available
33options, arranged according to their purpose.
34
35 There are two ways of writing options: the short forms that start with
36a single @samp{-}, and the long forms that start with @samp{--}. For
37example, @samp{-d} is a short form and @samp{--display} is the
38corresponding long form.
39
40 The long forms with @samp{--} are easier to remember, but longer to
41type. However, you don't have to spell out the whole option name; any
42unambiguous abbreviation is enough. When a long option takes an
43argument, you can use either a space or an equal sign to separate the
44option name and the argument. Thus, you can write either
45@samp{--display sugar-bombs:0.0} or @samp{--display=sugar-bombs:0.0}.
46We recommend an equal sign because it makes the relationship clearer,
47and the tables below always show an equal sign.
48
49@cindex initial options (command line)
50@cindex action options (command line)
51@vindex command-line-args
52 Most options specify how to initialize Emacs, or set parameters for
53the Emacs session. We call them @dfn{initial options}. A few options
63961e6a
CY
54specify things to do, such as loading libraries or calling Lisp
55functions. These are called @dfn{action options}. These and file
56names together are called @dfn{action arguments}. The action
57arguments are stored as a list of strings in the variable
58@code{command-line-args}. (Actually, when Emacs starts up,
59@code{command-line-args} contains all the arguments passed from the
60command line; during initialization, the initial arguments are removed
61from this list when they are processed, leaving only the action
62arguments.)
8cf51b2c
GM
63
64@menu
65* Action Arguments:: Arguments to visit files, load libraries,
66 and call functions.
67* Initial Options:: Arguments that take effect while starting Emacs.
68* Command Example:: Examples of using command line arguments.
8cf51b2c
GM
69* Environment:: Environment variables that Emacs uses.
70* Display X:: Changing the default display and using remote login.
71* Font X:: Choosing a font for text, under X.
8863a584 72* Colors X:: Choosing display colors.
8cf51b2c
GM
73* Window Size X:: Start-up window size, under X.
74* Borders X:: Internal and external borders, under X.
75* Title X:: Specifying the initial frame's title.
76* Icons X:: Choosing what sort of icon to use, under X.
77* Misc X:: Other display options.
78@end menu
79
80@node Action Arguments
81@appendixsec Action Arguments
82
63961e6a 83 Here is a table of action arguments:
8cf51b2c
GM
84
85@table @samp
86@item @var{file}
87@opindex --file
88@itemx --file=@var{file}
89@opindex --find-file
90@itemx --find-file=@var{file}
91@opindex --visit
92@itemx --visit=@var{file}
93@cindex visiting files, command-line argument
94@vindex inhibit-startup-buffer-menu
95Visit @var{file} using @code{find-file}. @xref{Visiting}.
63961e6a
CY
96
97When Emacs starts up, it displays the startup buffer in one window,
98and the buffer visiting @var{file} in another window
99(@pxref{Windows}). If you supply more than one file argument, the
100displayed file is the last one specified on the command line; the
101other files are visited but their buffers are not shown.
102
103If the startup buffer is disabled (@pxref{Entering Emacs}), then
104@var{file} is visited in a single window if one file argument was
105supplied; with two file arguments, Emacs displays the files in two
106different windows; with more than two file argument, Emacs displays
107the last file specified in one window, plus a Buffer Menu in a
108different window (@pxref{Several Buffers}). To inhibit using the
109Buffer Menu for this, change the variable
110@code{inhibit-startup-buffer-menu} to @code{t}.
8cf51b2c
GM
111
112@item +@var{linenum} @var{file}
113@opindex +@var{linenum}
114Visit @var{file} using @code{find-file}, then go to line number
115@var{linenum} in it.
116
117@item +@var{linenum}:@var{columnnum} @var{file}
118Visit @var{file} using @code{find-file}, then go to line number
119@var{linenum} and put point at column number @var{columnnum}.
120
8cf51b2c
GM
121@item -l @var{file}
122@opindex -l
123@itemx --load=@var{file}
124@opindex --load
125@cindex loading Lisp libraries, command-line argument
126Load a Lisp library named @var{file} with the function @code{load}.
a73a3461
CY
127If @var{file} is not an absolute file name, Emacs first looks for it
128in the current directory, then in the directories listed in
129@code{load-path} (@pxref{Lisp Libraries}).
8cf51b2c
GM
130
131@strong{Warning:} If previous command-line arguments have visited
132files, the current directory is the directory of the last file
133visited.
134
135@item -L @var{dir}
136@opindex -L
137@itemx --directory=@var{dir}
138@opindex --directory
1ba6984e 139Prepend directory @var{dir} to the variable @code{load-path}.
881db7e0
GM
140If you specify multiple @samp{-L} options, Emacs preserves the
141relative order; i.e., using @samp{-L /foo -L /bar} results in
142a @code{load-path} of the form @code{("/foo" "/bar" @dots{})}.
a0833f62
GM
143If @var{dir} begins with @samp{:}, Emacs removes the @samp{:} and
144appends (rather than prepends) the remainder to @code{load-path}.
2df10228
GM
145(On MS Windows, use @samp{;} instead of @samp{:}; i.e., use
146the value of @code{path-separator}.)
8cf51b2c
GM
147
148@item -f @var{function}
149@opindex -f
150@itemx --funcall=@var{function}
151@opindex --funcall
152@cindex call Lisp functions, command-line argument
153Call Lisp function @var{function}. If it is an interactive function
154(a command), it reads the arguments interactively just as if you had
155called the same function with a key sequence. Otherwise, it calls the
156function with no arguments.
157
158@item --eval=@var{expression}
159@opindex --eval
160@itemx --execute=@var{expression}
161@opindex --execute
162@cindex evaluate expression, command-line argument
163Evaluate Lisp expression @var{expression}.
164
165@item --insert=@var{file}
166@opindex --insert
167@cindex insert file contents, command-line argument
1c64e6ed 168Insert the contents of @var{file} into the @file{*scratch*} buffer
63961e6a
CY
169(@pxref{Lisp Interaction}). This is like what @kbd{M-x insert-file}
170does (@pxref{Misc File Ops}).
8cf51b2c
GM
171
172@item --kill
173@opindex --kill
174Exit from Emacs without asking for confirmation.
175
176@item --help
177@opindex --help
178Print a usage message listing all available options, then exit
179successfully.
180
181@item --version
182@opindex --version
183Print Emacs version, then exit successfully.
184@end table
185
186@node Initial Options
187@appendixsec Initial Options
188
189 The initial options specify parameters for the Emacs session. This
190section describes the more general initial options; some other options
191specifically related to the X Window System appear in the following
192sections.
193
63961e6a 194 Some initial options affect the loading of the initialization file.
a73a3461
CY
195Normally, Emacs first loads @file{site-start.el} if it exists, then
196your own initialization file if it exists, and finally the default
197initialization file @file{default.el} if it exists (@pxref{Init
198File}). Certain options prevent loading of some of these files or
199substitute other files for them.
8cf51b2c
GM
200
201@table @samp
f63d0028
JD
202@item -chdir @var{directory}
203@opindex -chdir
204@itemx --chdir=@var{directory}
205@opindex --chdir
206@cindex change Emacs directory
207Change to @var{directory} before doing anything else. This is mainly used
208by session management in X so that Emacs starts in the same directory as it
209stopped. This makes desktop saving and restoring easier.
210
8cf51b2c
GM
211@item -t @var{device}
212@opindex -t
213@itemx --terminal=@var{device}
214@opindex --terminal
215@cindex device for Emacs terminal I/O
a73a3461
CY
216Use @var{device} as the device for terminal input and output. This
217option implies @samp{--no-window-system}.
8cf51b2c
GM
218
219@item -d @var{display}
220@opindex -d
221@itemx --display=@var{display}
222@opindex --display
223@cindex display for Emacs frame
224Use the X Window System and use the display named @var{display} to open
225the initial Emacs frame. @xref{Display X}, for more details.
226
227@item -nw
228@opindex -nw
229@itemx --no-window-system
230@opindex --no-window-system
231@cindex disable window system
232Don't communicate directly with the window system, disregarding the
233@env{DISPLAY} environment variable even if it is set. This means that
234Emacs uses the terminal from which it was launched for all its display
235and input.
236
8cf51b2c
GM
237@cindex batch mode
238@item -batch
239@opindex --batch
240@itemx --batch
241Run Emacs in @dfn{batch mode}. Batch mode is used for running
242programs written in Emacs Lisp from shell scripts, makefiles, and so
63961e6a
CY
243on. To invoke a Lisp program, use the @samp{-batch} option in
244conjunction with one or more of @samp{-l}, @samp{-f} or @samp{--eval}
245(@pxref{Action Arguments}). @xref{Command Example}, for an example.
8cf51b2c
GM
246
247In batch mode, Emacs does not display the text being edited, and the
248standard terminal interrupt characters such as @kbd{C-z} and @kbd{C-c}
63961e6a
CY
249have their usual effect. Emacs functions that normally print a
250message in the echo area will print to either the standard output
251stream (@code{stdout}) or the standard error stream (@code{stderr})
252instead. (To be precise, functions like @code{prin1}, @code{princ}
253and @code{print} print to @code{stdout}, while @code{message} and
254@code{error} print to @code{stderr}.) Functions that normally read
255keyboard input from the minibuffer take their input from the
256terminal's standard input stream (@code{stdin}) instead.
257
258@samp{--batch} implies @samp{-q} (do not load an initialization file),
259but @file{site-start.el} is loaded nonetheless. It also causes Emacs
260to exit after processing all the command options. In addition, it
a73a3461 261disables auto-saving except in buffers for which auto-saving is
cbee2131
PE
262explicitly requested, and when saving files it omits the @code{fsync}
263system call unless otherwise requested.
8cf51b2c
GM
264
265@item --script @var{file}
266@opindex --script
267@cindex script mode
268Run Emacs in batch mode, like @samp{--batch}, and then read and
269execute the Lisp code in @var{file}.
270
271The normal use of this option is in executable script files that run
272Emacs. They can start with this text on the first line
273
274@example
275#!/usr/bin/emacs --script
276@end example
277
278@noindent
279which will invoke Emacs with @samp{--script} and supply the name of
a73a3461
CY
280the script file as @var{file}. Emacs Lisp then treats the @samp{#!}
281on this first line as a comment delimiter.
8cf51b2c
GM
282
283@item -q
284@opindex -q
285@itemx --no-init-file
286@opindex --no-init-file
287@cindex bypassing init and @file{default.el} file
288@cindex init file, not loading
289@cindex @file{default.el} file, not loading
a73a3461
CY
290Do not load any initialization file (@pxref{Init File}). When Emacs
291is invoked with this option, the Customize facility does not allow
292options to be saved (@pxref{Easy Customization}). This option does
293not disable loading @file{site-start.el}.
8cf51b2c
GM
294
295@item --no-site-file
296@opindex --no-site-file
297@cindex @file{site-start.el} file, not loading
fdeb32ec
CY
298Do not load @file{site-start.el} (@pxref{Init File}). The @samp{-Q}
299option does this too, but other options like @samp{-q} do not.
300
301@item --no-site-lisp
302@opindex --no-site-lisp
303@cindex @file{site-start.el} file, not loading
304Do not include the @file{site-lisp} directories in @code{load-path}
305(@pxref{Init File}). The @samp{-Q} option does this too.
8cf51b2c 306
63961e6a
CY
307@item --no-splash
308@opindex --no-splash
309@vindex inhibit-startup-screen
310@cindex splash screen
311@cindex startup message
312Do not display a startup screen. You can also achieve this effect by
313setting the variable @code{inhibit-startup-screen} to non-@code{nil}
314in your initialization file (@pxref{Entering Emacs}).
315
8cf51b2c
GM
316@item -Q
317@opindex -Q
318@itemx --quick
319@opindex --quick
9eb25ee8 320Start emacs with minimum customizations. This is similar to using @samp{-q},
fdeb32ec
CY
321@samp{--no-site-file}, @samp{--no-site-lisp}, and @samp{--no-splash}
322together. This also stops Emacs from processing X resources by
323setting @code{inhibit-x-resources} to @code{t} (@pxref{Resources}).
8cf51b2c 324
eab2ee89
DN
325@item -daemon
326@opindex -daemon
327@itemx --daemon
328@opindex --daemon
63961e6a
CY
329Start Emacs as a daemon---after Emacs starts up, it starts the Emacs
330server and disconnects from the terminal without opening any frames.
331You can then use the @command{emacsclient} command to connect to Emacs
332for editing. @xref{Emacs Server}, for information about using Emacs
333as a daemon.
eab2ee89 334
4ff029f6 335@item -daemon=@var{SERVER-NAME}
63961e6a
CY
336Start emacs in background as a daemon, and use @var{SERVER-NAME} as
337the server name.
8cf51b2c
GM
338
339@item --no-desktop
340@opindex --no-desktop
341Do not reload any saved desktop. @xref{Saving Emacs Sessions}.
342
343@item -u @var{user}
344@opindex -u
345@itemx --user=@var{user}
346@opindex --user
347@cindex load init file of another user
63961e6a
CY
348Load @var{user}'s initialization file instead of your
349own@footnote{This option has no effect on MS-Windows.}.
8cf51b2c
GM
350
351@item --debug-init
352@opindex --debug-init
353@cindex errors in init file
354Enable the Emacs Lisp debugger for errors in the init file.
355@xref{Error Debugging,, Entering the Debugger on an Error, elisp, The
356GNU Emacs Lisp Reference Manual}.
76a87a4d 357@end table
8cf51b2c 358
8cf51b2c
GM
359@node Command Example
360@appendixsec Command Argument Example
361
362 Here is an example of using Emacs with arguments and options. It
363assumes you have a Lisp program file called @file{hack-c.el} which, when
364loaded, performs some useful operation on the current buffer, expected
365to be a C program.
366
367@example
368emacs --batch foo.c -l hack-c -f save-buffer >& log
369@end example
370
371@noindent
372This says to visit @file{foo.c}, load @file{hack-c.el} (which makes
373changes in the visited file), save @file{foo.c} (note that
374@code{save-buffer} is the function that @kbd{C-x C-s} is bound to), and
375then exit back to the shell (because of @samp{--batch}). @samp{--batch}
376also guarantees there will be no problem redirecting output to
377@file{log}, because Emacs will not assume that it has a display terminal
378to work with.
379
8cf51b2c
GM
380@node Environment
381@appendixsec Environment Variables
382@cindex environment variables
383
384 The @dfn{environment} is a feature of the operating system; it
385consists of a collection of variables with names and values. Each
386variable is called an @dfn{environment variable}; environment variable
387names are case-sensitive, and it is conventional to use upper case
388letters only. The values are all text strings.
389
390 What makes the environment useful is that subprocesses inherit the
391environment automatically from their parent process. This means you
392can set up an environment variable in your login shell, and all the
393programs you run (including Emacs) will automatically see it.
a73a3461
CY
394Subprocesses of Emacs (such as shells, compilers, and version control
395programs) inherit the environment from Emacs, too.
8cf51b2c
GM
396
397@findex setenv
398@findex getenv
63961e6a 399@vindex initial-environment
a73a3461
CY
400 Inside Emacs, the command @kbd{M-x getenv} reads the name of an
401environment variable, and prints its value in the echo area. @kbd{M-x
402setenv} sets a variable in the Emacs environment, and @kbd{C-u M-x
403setenv} removes a variable. (Environment variable substitutions with
404@samp{$} work in the value just as in file names; see @ref{File Names
405with $}.) The variable @code{initial-environment} stores the initial
406environment inherited by Emacs.
8cf51b2c
GM
407
408 The way to set environment variables outside of Emacs depends on the
409operating system, and especially the shell that you are using. For
410example, here's how to set the environment variable @env{ORGANIZATION}
411to @samp{not very much} using Bash:
412
413@example
414export ORGANIZATION="not very much"
415@end example
416
417@noindent
418and here's how to do it in csh or tcsh:
419
420@example
421setenv ORGANIZATION "not very much"
422@end example
423
424 When Emacs is using the X Window System, various environment
425variables that control X work for Emacs as well. See the X
426documentation for more information.
427
428@menu
429* General Variables:: Environment variables that all versions of Emacs use.
430* Misc Variables:: Certain system-specific variables.
431* MS-Windows Registry:: An alternative to the environment on MS-Windows.
432@end menu
433
434@node General Variables
435@appendixsubsec General Variables
436
63961e6a
CY
437 Here is an alphabetical list of environment variables that have
438special meanings in Emacs. Most of these variables are also used by
439some other programs. Emacs does not require any of these environment
440variables to be set, but it uses their values if they are set.
8cf51b2c 441
f982b371 442@vtable @env
8cf51b2c
GM
443@item CDPATH
444Used by the @code{cd} command to search for the directory you specify,
445when you specify a relative directory name.
aa0ecd94
MA
446@item DBUS_SESSION_BUS_ADDRESS
447Used by D-Bus when Emacs is compiled with it. Usually, there is no
448need to change it. Setting it to a dummy address, like
2041ae1f
MA
449@samp{unix:path=/dev/null}, suppresses connections to the D-Bus session
450bus as well as autolaunching the D-Bus session bus if not running yet.
8cf51b2c
GM
451@item EMACSDATA
452Directory for the architecture-independent files that come with Emacs.
166bc0c8 453This is used to initialize the variable @code{data-directory}.
8cf51b2c 454@item EMACSDOC
ae742cb5
CY
455Directory for the documentation string file, which is used to
456initialize the Lisp variable @code{doc-directory}.
8cf51b2c 457@item EMACSLOADPATH
17e0445b 458A colon-separated list of directories@footnote{Here and below,
16152b76 459whenever we say ``colon-separated list of directories'', it pertains
a73a3461
CY
460to Unix and GNU/Linux systems. On MS-DOS and MS-Windows, the
461directories are separated by semi-colons instead, since DOS/Windows
17e0445b
GM
462file names might include a colon after a drive letter.} to search for
463Emacs Lisp files. If set, it modifies the usual initial value of the
464@code{load-path} variable (@pxref{Lisp Libraries}). An empty element
465stands for the default value of @code{load-path}; e.g., using
466@samp{EMACSLOADPATH="/tmp:"} adds @file{/tmp} to the front of
f982b371
EZ
467the default @code{load-path}. To specify an empty element in the
468middle of the list, use 2 colons in a row, as in
469@samp{EMACSLOADPATH="/tmp::/foo"}.
8cf51b2c 470@item EMACSPATH
a73a3461
CY
471A colon-separated list of directories to search for executable files.
472If set, Emacs uses this in addition to @env{PATH} (see below) when
473initializing the variable @code{exec-path} (@pxref{Shell}).
8cf51b2c
GM
474@item EMAIL
475@vindex user-mail-address@r{, initialization}
476Your email address; used to initialize the Lisp variable
a73a3461
CY
477@code{user-mail-address}, which the Emacs mail interface puts into the
478@samp{From} header of outgoing messages (@pxref{Mail Headers}).
8cf51b2c 479@item ESHELL
a73a3461
CY
480Used for shell-mode to override the @env{SHELL} environment variable
481(@pxref{Interactive Shell}).
8cf51b2c
GM
482@item HISTFILE
483The name of the file that shell commands are saved in between logins.
484This variable defaults to @file{~/.bash_history} if you use Bash, to
485@file{~/.sh_history} if you use ksh, and to @file{~/.history}
486otherwise.
487@item HOME
488The location of your files in the directory tree; used for
489expansion of file names starting with a tilde (@file{~}). On MS-DOS,
490it defaults to the directory from which Emacs was started, with
491@samp{/bin} removed from the end if it was present. On Windows, the
492default value of @env{HOME} is the @file{Application Data}
493subdirectory of the user profile directory (normally, this is
494@file{C:/Documents and Settings/@var{username}/Application Data},
495where @var{username} is your user name), though for backwards
496compatibility @file{C:/} will be used instead if a @file{.emacs} file
497is found there.
498@item HOSTNAME
499The name of the machine that Emacs is running on.
46e3f6b5
GM
500@c complete.el is obsolete since 24.1.
501@ignore
8cf51b2c
GM
502@item INCPATH
503A colon-separated list of directories. Used by the @code{complete} package
504to search for files.
46e3f6b5 505@end ignore
8cf51b2c
GM
506@item INFOPATH
507A colon-separated list of directories in which to search for Info files.
508@item LC_ALL
509@itemx LC_COLLATE
510@itemx LC_CTYPE
511@itemx LC_MESSAGES
512@itemx LC_MONETARY
513@itemx LC_NUMERIC
514@itemx LC_TIME
515@itemx LANG
516The user's preferred locale. The locale has six categories, specified
517by the environment variables @env{LC_COLLATE} for sorting,
518@env{LC_CTYPE} for character encoding, @env{LC_MESSAGES} for system
519messages, @env{LC_MONETARY} for monetary formats, @env{LC_NUMERIC} for
520numbers, and @env{LC_TIME} for dates and times. If one of these
521variables is not set, the category defaults to the value of the
522@env{LANG} environment variable, or to the default @samp{C} locale if
523@env{LANG} is not set. But if @env{LC_ALL} is specified, it overrides
524the settings of all the other locale environment variables.
525
526On MS-Windows, if @env{LANG} is not already set in the environment
527when Emacs starts, Emacs sets it based on the system-wide default
528language, which you can set in the @samp{Regional Settings} Control Panel
529on some versions of MS-Windows.
530
531The value of the @env{LC_CTYPE} category is
532matched against entries in @code{locale-language-names},
533@code{locale-charset-language-names}, and
534@code{locale-preferred-coding-systems}, to select a default language
535environment and coding system. @xref{Language Environments}.
536@item LOGNAME
537The user's login name. See also @env{USER}.
538@item MAIL
539The name of your system mail inbox.
a73a3461 540@ifnottex
8cf51b2c 541@item MH
a73a3461
CY
542Name of setup file for the mh system. @xref{Top,,MH-E,mh-e, The Emacs
543Interface to MH}.
544@end ifnottex
8cf51b2c 545@item NAME
a73a3461
CY
546Your real-world name. This is used to initialize the variable
547@code{user-full-name} (@pxref{Mail Headers}).
8cf51b2c
GM
548@item NNTPSERVER
549The name of the news server. Used by the mh and Gnus packages.
550@item ORGANIZATION
551The name of the organization to which you belong. Used for setting the
552`Organization:' header in your posts from the Gnus package.
553@item PATH
a73a3461
CY
554A colon-separated list of directories containing executable files.
555This is used to initialize the variable @code{exec-path}
556(@pxref{Shell}).
8cf51b2c
GM
557@item PWD
558If set, this should be the default directory when Emacs was started.
559@item REPLYTO
560If set, this specifies an initial value for the variable
a73a3461 561@code{mail-default-reply-to} (@pxref{Mail Headers}).
8cf51b2c
GM
562@item SAVEDIR
563The name of a directory in which news articles are saved by default.
564Used by the Gnus package.
565@item SHELL
566The name of an interpreter used to parse and execute programs run from
567inside Emacs.
568@item SMTPSERVER
a73a3461
CY
569The name of the outgoing mail server. This is used to initialize the
570variable @code{smtpmail-smtp-server} (@pxref{Mail Sending}).
8cf51b2c
GM
571@cindex background mode, on @command{xterm}
572@item TERM
573The type of the terminal that Emacs is using. This variable must be
574set unless Emacs is run in batch mode. On MS-DOS, it defaults to
575@samp{internal}, which specifies a built-in terminal emulation that
a73a3461 576handles the machine's own display.
8cf51b2c
GM
577@item TERMCAP
578The name of the termcap library file describing how to program the
a73a3461 579terminal specified by @env{TERM}. This defaults to
8cf51b2c
GM
580@file{/etc/termcap}.
581@item TMPDIR
a73a3461
CY
582@itemx TMP
583@itemx TEMP
584These environment variables are used to initialize the variable
585@code{temporary-file-directory}, which specifies a directory in which
586to put temporary files (@pxref{Backup}). Emacs tries to use
a683d06b
PE
587@env{TMPDIR} first. If that is unset, Emacs normally falls back on
588@file{/tmp}, but on MS-Windows and MS-DOS it instead falls back on
589@env{TMP}, then @env{TEMP}, and finally @file{c:/temp}.
a73a3461 590
8cf51b2c
GM
591@item TZ
592This specifies the current time zone and possibly also daylight
593saving time information. On MS-DOS, if @env{TZ} is not set in the
594environment when Emacs starts, Emacs defines a default value as
1df7defd 595appropriate for the country code returned by DOS@. On MS-Windows, Emacs
8cf51b2c
GM
596does not use @env{TZ} at all.
597@item USER
598The user's login name. See also @env{LOGNAME}. On MS-DOS, this
599defaults to @samp{root}.
600@item VERSION_CONTROL
84f4a531
CY
601Used to initialize the @code{version-control} variable (@pxref{Backup
602Names}).
f982b371 603@end vtable
8cf51b2c
GM
604
605@node Misc Variables
606@appendixsubsec Miscellaneous Variables
607
608These variables are used only on particular configurations:
609
f982b371 610@vtable @env
8cf51b2c
GM
611@item COMSPEC
612On MS-DOS and MS-Windows, the name of the command interpreter to use
613when invoking batch files and commands internal to the shell. On MS-DOS
614this is also used to make a default value for the @env{SHELL} environment
615variable.
616
617@item NAME
618On MS-DOS, this variable defaults to the value of the @env{USER}
619variable.
620
8cf51b2c
GM
621@item EMACSTEST
622On MS-DOS, this specifies a file to use to log the operation of the
623internal terminal emulator. This feature is useful for submitting bug
624reports.
625
626@item EMACSCOLORS
627On MS-DOS, this specifies the screen colors. It is useful to set them
628this way, since otherwise Emacs would display the default colors
629momentarily when it starts up.
630
631The value of this variable should be the two-character encoding of the
632foreground (the first character) and the background (the second
633character) colors of the default face. Each character should be the
634hexadecimal code for the desired color on a standard PC text-mode
635display. For example, to get blue text on a light gray background,
636specify @samp{EMACSCOLORS=17}, since 1 is the code of the blue color and
6377 is the code of the light gray color.
638
639The PC display usually supports only eight background colors. However,
640Emacs switches the DOS display to a mode where all 16 colors can be used
641for the background, so all four bits of the background color are
642actually used.
643
8cf51b2c
GM
644@item PRELOAD_WINSOCK
645On MS-Windows, if you set this variable, Emacs will load and initialize
646the network library at startup, instead of waiting until the first
647time it is required.
648
649@item emacs_dir
650On MS-Windows, @env{emacs_dir} is a special environment variable, which
651indicates the full path of the directory in which Emacs is installed.
652If Emacs is installed in the standard directory structure, it
653calculates this value automatically. It is not much use setting this
654variable yourself unless your installation is non-standard, since
655unlike other environment variables, it will be overridden by Emacs at
656startup. When setting other environment variables, such as
657@env{EMACSLOADPATH}, you may find it useful to use @env{emacs_dir}
658rather than hard-coding an absolute path. This allows multiple
659versions of Emacs to share the same environment variable settings, and
660it allows you to move the Emacs installation directory, without
661changing any environment or registry settings.
f982b371 662@end vtable
8cf51b2c
GM
663
664@node MS-Windows Registry
665@appendixsubsec The MS-Windows System Registry
666@pindex addpm, MS-Windows installation program
8034735f 667@cindex registry, setting environment variables (MS-Windows)
8cf51b2c 668
8034735f 669On MS-Windows, the installation program @command{addpm.exe} adds
8cf51b2c
GM
670values for @env{emacs_dir}, @env{EMACSLOADPATH}, @env{EMACSDATA},
671@env{EMACSPATH}, @env{EMACSDOC}, @env{SHELL} and @env{TERM} to the
672@file{HKEY_LOCAL_MACHINE} section of the system registry, under
673@file{/Software/GNU/Emacs}. It does this because there is no standard
674place to set environment variables across different versions of
675Windows. Running @command{addpm.exe} is no longer strictly necessary
676in recent versions of Emacs, but if you are upgrading from an older
677version, running @command{addpm.exe} ensures that you do not have
678older registry entries from a previous installation, which may not be
679compatible with the latest version of Emacs.
680
681When Emacs starts, as well as checking the environment, it also checks
682the System Registry for those variables and for @env{HOME}, @env{LANG}
683and @env{PRELOAD_WINSOCK}.
684
685To determine the value of those variables, Emacs goes through the
686following procedure. First, the environment is checked. If the
687variable is not found there, Emacs looks for registry keys by that
688name under @file{/Software/GNU/Emacs}; first in the
689@file{HKEY_CURRENT_USER} section of the registry, and if not found
690there, in the @file{HKEY_LOCAL_MACHINE} section. Finally, if Emacs
691still cannot determine the values, compiled-in defaults are used.
692
693In addition to the environment variables above, you can also add many
694of the settings which on X belong in the @file{.Xdefaults} file
695(@pxref{X Resources}) to the @file{/Software/GNU/Emacs} registry key.
8cf51b2c
GM
696
697@node Display X
698@appendixsec Specifying the Display Name
699@cindex display name (X Window System)
700@cindex @env{DISPLAY} environment variable
701
a73a3461
CY
702 The environment variable @env{DISPLAY} tells all X clients,
703including Emacs, where to display their windows. Its value is set by
704default in ordinary circumstances, when you start an X server and run
705jobs locally. You can specify the display yourself; one reason to do
706this is if you want to log into another system and run Emacs there,
707and have the window displayed at your local terminal.
8cf51b2c 708
ae742cb5 709 @env{DISPLAY} has the syntax
8cf51b2c
GM
710@samp{@var{host}:@var{display}.@var{screen}}, where @var{host} is the
711host name of the X Window System server machine, @var{display} is an
ae742cb5
CY
712arbitrarily-assigned number that distinguishes your server (X
713terminal) from other servers on the same machine, and @var{screen} is
a73a3461
CY
714a field that allows an X server to control multiple terminal screens.
715The period and the @var{screen} field are optional. If included,
716@var{screen} is usually zero.
8cf51b2c
GM
717
718 For example, if your host is named @samp{glasperle} and your server is
719the first (or perhaps the only) server listed in the configuration, your
720@env{DISPLAY} is @samp{glasperle:0.0}.
721
722 You can specify the display name explicitly when you run Emacs, either
723by changing the @env{DISPLAY} variable, or with the option @samp{-d
724@var{display}} or @samp{--display=@var{display}}. Here is an example:
725
726@smallexample
727emacs --display=glasperle:0 &
728@end smallexample
729
a73a3461
CY
730 You can inhibit the use of the X window system with the @samp{-nw}
731option. Then Emacs uses its controlling text terminal for display.
732@xref{Initial Options}.
8cf51b2c
GM
733
734 Sometimes, security arrangements prevent a program on a remote system
735from displaying on your local system. In this case, trying to run Emacs
736produces messages like this:
737
738@smallexample
739Xlib: connection to "glasperle:0.0" refused by server
740@end smallexample
741
742@noindent
743You might be able to overcome this problem by using the @command{xhost}
744command on the local system to give permission for access from your
745remote machine.
746
747@node Font X
748@appendixsec Font Specification Options
749@cindex font name (X Window System)
750
d68eb23c
CY
751You can use the command line option @samp{-fn @var{font}} (or
752@samp{--font}, which is an alias for @samp{-fn}) to specify a default
753font:
8cf51b2c
GM
754
755@table @samp
0e3f4049 756@item -fn @var{font}
8cf51b2c 757@opindex -fn
0e3f4049 758@itemx --font=@var{font}
8cf51b2c
GM
759@opindex --font
760@cindex specify default font from the command line
0e3f4049 761Use @var{font} as the default font.
8cf51b2c
GM
762@end table
763
a73a3461
CY
764When passing a font name to Emacs on the command line, you may need to
765``quote'' it, by enclosing it in quotation marks, if it contains
1df7defd 766characters that the shell treats specially (e.g., spaces). For
a73a3461 767example:
001b5dc9
CY
768
769@smallexample
770emacs -fn "DejaVu Sans Mono-12"
771@end smallexample
772
a73a3461
CY
773@xref{Fonts}, for details about font names and other ways to specify
774the default font.
8cf51b2c 775
8863a584 776@node Colors X
8cf51b2c
GM
777@appendixsec Window Color Options
778@cindex color of window, from command line
779@cindex text colors, from command line
780
8863a584
CY
781 You can use the following command-line options to specify the colors
782to use for various parts of the Emacs display. Colors may be
783specified using either color names or RGB triplets (@pxref{Colors}).
8cf51b2c
GM
784
785@table @samp
786@item -fg @var{color}
787@opindex -fg
788@itemx --foreground-color=@var{color}
789@opindex --foreground-color
790@cindex foreground color, command-line argument
8863a584
CY
791Specify the foreground color, overriding the color specified by the
792@code{default} face (@pxref{Faces}).
8cf51b2c
GM
793@item -bg @var{color}
794@opindex -bg
795@itemx --background-color=@var{color}
796@opindex --background-color
797@cindex background color, command-line argument
8863a584
CY
798Specify the background color, overriding the color specified by the
799@code{default} face.
8cf51b2c
GM
800@item -bd @var{color}
801@opindex -bd
802@itemx --border-color=@var{color}
803@opindex --border-color
804@cindex border color, command-line argument
a73a3461
CY
805Specify the color of the border of the X window. This has no effect
806if Emacs is compiled with GTK+ support.
8cf51b2c
GM
807@item -cr @var{color}
808@opindex -cr
809@itemx --cursor-color=@var{color}
810@opindex --cursor-color
811@cindex cursor color, command-line argument
812Specify the color of the Emacs cursor which indicates where point is.
813@item -ms @var{color}
814@opindex -ms
815@itemx --mouse-color=@var{color}
816@opindex --mouse-color
817@cindex mouse pointer color, command-line argument
818Specify the color for the mouse cursor when the mouse is in the Emacs window.
819@item -r
820@opindex -r
821@itemx -rv
822@opindex -rv
823@itemx --reverse-video
824@opindex --reverse-video
825@cindex reverse video, command-line argument
826Reverse video---swap the foreground and background colors.
827@item --color=@var{mode}
828@opindex --color
829@cindex standard colors on a character terminal
830@cindex override character terminal color support
a73a3461
CY
831Set the @dfn{color support mode} when Emacs is run on a text terminal.
832This option overrides the number of supported colors that the
833character terminal advertises in its @code{termcap} or @code{terminfo}
834database. The parameter @var{mode} can be one of the following:
8cf51b2c
GM
835@table @samp
836@item never
837@itemx no
838Don't use colors even if the terminal's capabilities specify color
839support.
840@item default
841@itemx auto
842Same as when @option{--color} is not used at all: Emacs detects at
843startup whether the terminal supports colors, and if it does, turns on
844colored display.
845@item always
846@itemx yes
847@itemx ansi8
848Turn on the color support unconditionally, and use color commands
849specified by the ANSI escape sequences for the 8 standard colors.
850@item @var{num}
851Use color mode for @var{num} colors. If @var{num} is -1, turn off
852color support (equivalent to @samp{never}); if it is 0, use the
853default color support for this terminal (equivalent to @samp{auto});
854otherwise use an appropriate standard mode for @var{num} colors.
855Depending on your terminal's capabilities, Emacs might be able to turn
856on a color mode for 8, 16, 88, or 256 as the value of @var{num}. If
857there is no mode that supports @var{num} colors, Emacs acts as if
1df7defd 858@var{num} were 0, i.e., it uses the terminal's default color support
8cf51b2c
GM
859mode.
860@end table
861If @var{mode} is omitted, it defaults to @var{ansi8}.
862@end table
863
864 For example, to use a coral mouse cursor and a slate blue text cursor,
865enter:
866
867@example
868emacs -ms coral -cr 'slate blue' &
869@end example
870
871 You can reverse the foreground and background colors through the
872@samp{-rv} option or with the X resource @samp{reverseVideo}.
873
0be641c0
CY
874 The @samp{-fg}, @samp{-bg}, and @samp{-rv} options function on text
875terminals as well as on graphical displays.
8cf51b2c
GM
876
877@node Window Size X
878@appendixsec Options for Window Size and Position
879@cindex geometry of Emacs window
880@cindex position and size of Emacs frame
881@cindex width and height of Emacs frame
882@cindex specifying fullscreen for Emacs frame
883
884 Here is a list of the command-line options for specifying size and
885position of the initial Emacs frame:
886
887@table @samp
888@item -g @var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
889@opindex -g
890@itemx --geometry=@var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
891@opindex --geometry
892@cindex geometry, command-line argument
893Specify the size @var{width} and @var{height} (measured in character
894columns and lines), and positions @var{xoffset} and @var{yoffset}
895(measured in pixels). The @var{width} and @var{height} parameters
896apply to all frames, whereas @var{xoffset} and @var{yoffset} only to
897the initial frame.
898
899@item -fs
900@opindex -fs
901@itemx --fullscreen
902@opindex --fullscreen
903@cindex fullscreen, command-line argument
881aae56
GM
904Specify that width and height should be that of the screen. Normally
905no window manager decorations are shown. (After starting Emacs,
906you can toggle this state using @key{F11}, @code{toggle-frame-fullscreen}.)
3f1c6666
JD
907
908@item -mm
909@opindex -mm
910@itemx --maximized
911@opindex --maximized
912@cindex maximized, command-line argument
881aae56 913Specify that the Emacs frame should be maximized. This normally
3f1c6666 914means that the frame has window manager decorations.
881aae56
GM
915(After starting Emacs, you can toggle this state using @kbd{M-F10},
916@code{toggle-frame-maximized}.)
8cf51b2c
GM
917
918@item -fh
919@opindex -fh
920@itemx --fullheight
921@opindex --fullheight
922@cindex fullheight, command-line argument
881aae56 923Specify that the height should be the height of the screen.
8cf51b2c
GM
924
925@item -fw
926@opindex -fw
927@itemx --fullwidth
928@opindex --fullwidth
929@cindex fullwidth, command-line argument
881aae56 930Specify that the width should be the width of the screen.
8cf51b2c
GM
931@end table
932
8cf51b2c
GM
933@noindent
934In the @samp{--geometry} option, @code{@r{@{}+-@r{@}}} means either a plus
935 sign or a minus sign. A plus
936sign before @var{xoffset} means it is the distance from the left side of
937the screen; a minus sign means it counts from the right side. A plus
938sign before @var{yoffset} means it is the distance from the top of the
939screen, and a minus sign there indicates the distance from the bottom.
940The values @var{xoffset} and @var{yoffset} may themselves be positive or
941negative, but that doesn't change their meaning, only their direction.
942
943 Emacs uses the same units as @command{xterm} does to interpret the geometry.
944The @var{width} and @var{height} are measured in characters, so a large font
945creates a larger frame than a small font. (If you specify a proportional
946font, Emacs uses its maximum bounds width as the width unit.) The
947@var{xoffset} and @var{yoffset} are measured in pixels.
948
949 You do not have to specify all of the fields in the geometry
950specification. If you omit both @var{xoffset} and @var{yoffset}, the
951window manager decides where to put the Emacs frame, possibly by
952letting you place it with the mouse. For example, @samp{164x55}
953specifies a window 164 columns wide, enough for two ordinary width
954windows side by side, and 55 lines tall.
955
07c75e57 956 The default frame width is 80 characters and the default height is
8cf51b2c
GM
95740 lines. You can omit either the width or the height or both. If
958you start the geometry with an integer, Emacs interprets it as the
959width. If you start with an @samp{x} followed by an integer, Emacs
07c75e57
CY
960interprets it as the height. Thus, @samp{81} specifies just the
961width; @samp{x45} specifies just the height.
8cf51b2c
GM
962
963 If you start with @samp{+} or @samp{-}, that introduces an offset,
964which means both sizes are omitted. Thus, @samp{-3} specifies the
965@var{xoffset} only. (If you give just one offset, it is always
966@var{xoffset}.) @samp{+3-3} specifies both the @var{xoffset} and the
967@var{yoffset}, placing the frame near the bottom left of the screen.
968
07c75e57
CY
969 You can specify a default for any or all of the fields in your X
970resource file (@pxref{Resources}), and then override selected fields
971with a @samp{--geometry} option.
8cf51b2c
GM
972
973 Since the mode line and the echo area occupy the last 2 lines of the
974frame, the height of the initial text window is 2 less than the height
975specified in your geometry. In non-X-toolkit versions of Emacs, the
976menu bar also takes one line of the specified number. But in the X
977toolkit version, the menu bar is additional and does not count against
978the specified height. The tool bar, if present, is also additional.
979
980 Enabling or disabling the menu bar or tool bar alters the amount of
981space available for ordinary text. Therefore, if Emacs starts up with
982a tool bar (which is the default), and handles the geometry
983specification assuming there is a tool bar, and then your
07c75e57 984initialization file disables the tool bar, you will end up with a
8cf51b2c
GM
985frame geometry different from what you asked for. To get the intended
986size with no tool bar, use an X resource to specify ``no tool bar''
987(@pxref{Table of Resources}); then Emacs will already know there's no
988tool bar when it processes the specified geometry.
989
3f1c6666
JD
990 When using one of @samp{--fullscreen}, @samp{--maximized}, @samp{--fullwidth}
991or @samp{--fullheight} there may be some space around the frame
8cf51b2c
GM
992anyway. That is because Emacs rounds the sizes so they are an
993even number of character heights and widths.
994
995 Some window managers have options that can make them ignore both
07c75e57
CY
996program-specified and user-specified positions. If these are set,
997Emacs fails to position the window correctly.
8cf51b2c
GM
998
999@node Borders X
1000@appendixsec Internal and External Borders
1001@cindex borders (X Window System)
1002
1003 An Emacs frame has an internal border and an external border. The
1004internal border is an extra strip of the background color around the
1005text portion of the frame. Emacs itself draws the internal border.
1006The external border is added by the window manager outside the frame;
1007depending on the window manager you use, it may contain various boxes
1008you can click on to move or iconify the window.
1009
1010@table @samp
1011@item -ib @var{width}
1012@opindex -ib
1013@itemx --internal-border=@var{width}
1014@opindex --internal-border
1015@cindex internal border width, command-line argument
1016Specify @var{width} as the width of the internal border (between the text
1017and the main border), in pixels.
1018
1019@item -bw @var{width}
1020@opindex -bw
1021@itemx --border-width=@var{width}
1022@opindex --border-width
1023@cindex main border width, command-line argument
1024Specify @var{width} as the width of the main border, in pixels.
1025@end table
1026
1027 When you specify the size of the frame, that does not count the
1028borders. The frame's position is measured from the outside edge of the
1029external border.
1030
1031 Use the @samp{-ib @var{n}} option to specify an internal border
1032@var{n} pixels wide. The default is 1. Use @samp{-bw @var{n}} to
1033specify the width of the external border (though the window manager may
1034not pay attention to what you specify). The default width of the
1035external border is 2.
1036
1037@node Title X
1038@appendixsec Frame Titles
1039
1040 An Emacs frame may or may not have a specified title. The frame
1041title, if specified, appears in window decorations and icons as the
1042name of the frame. If an Emacs frame has no specified title, the
1043default title has the form @samp{@var{invocation-name}@@@var{machine}}
1044(if there is only one frame) or the selected window's buffer name (if
1045there is more than one frame).
1046
1047 You can specify a title for the initial Emacs frame with a command
1048line option:
1049
1050@table @samp
1051@item -T @var{title}
1052@opindex -T
1053@itemx --title=@var{title}
1054@opindex --title
1055@cindex frame title, command-line argument
1056Specify @var{title} as the title for the initial Emacs frame.
1057@end table
1058
1059 The @samp{--name} option (@pxref{Resources}) also specifies the title
1060for the initial Emacs frame.
1061
1062@node Icons X
1063@appendixsec Icons
1064@cindex icons (X Window System)
07c75e57 1065@cindex minimizing a frame at startup
8cf51b2c
GM
1066
1067@table @samp
07c75e57
CY
1068@item -iconic
1069@opindex --iconic
1070@itemx --iconic
1071@cindex start iconified, command-line argument
1072Start Emacs in an iconified (``minimized'') state.
1073
8cf51b2c
GM
1074@item -nbi
1075@opindex -nbi
1076@itemx --no-bitmap-icon
1077@opindex --no-bitmap-icon
1078@cindex Emacs icon, a gnu
a73a3461 1079Disable the use of the Emacs icon.
8cf51b2c
GM
1080@end table
1081
07c75e57
CY
1082 Most window managers allow you to ``iconify'' (or ``minimize'') an
1083Emacs frame, hiding it from sight. Some window managers replace
1084iconified windows with tiny ``icons'', while others remove them
1085entirely from sight. The @samp{-iconic} option tells Emacs to begin
1086running in an iconified state, rather than showing a frame right away.
1087The text frame doesn't appear until you deiconify (or ``un-minimize'')
1088it.
8cf51b2c 1089
07c75e57 1090 By default, Emacs uses an icon containing the Emacs logo. On
a73a3461 1091desktop environments such as Gnome, this icon is also displayed in
1df7defd 1092other contexts, e.g., when switching into an Emacs frame. The
a73a3461
CY
1093@samp{-nbi} or @samp{--no-bitmap-icon} option tells Emacs to let the
1094window manager choose what sort of icon to use---usually just a small
1095rectangle containing the frame's title.
8cf51b2c
GM
1096
1097@node Misc X
1098@appendixsec Other Display Options
1099
1100@table @samp
07c75e57
CY
1101@c @item -hb
1102@c @opindex -hb
1103@c @itemx --horizontal-scroll-bars
1104@c @opindex --horizontal-scroll-bars
1105@c @c @cindex horizontal scroll bars, command-line argument
1106@c Enable horizontal scroll bars. Since horizontal scroll bars
1107@c are not yet implemented, this actually does nothing.
8cf51b2c 1108
fdeb32ec
CY
1109@item --parent-id @var{ID}
1110Open Emacs as a client X window via the XEmbed protocol, with @var{ID}
1111as the parent X window id. Currently, this option is mainly useful
1112for developers.
1113
8cf51b2c
GM
1114@item -vb
1115@opindex -vb
1116@itemx --vertical-scroll-bars
1117@opindex --vertical-scroll-bars
1118@cindex vertical scroll bars, command-line argument
1119Enable vertical scroll bars.
1120
1121@item -lsp @var{pixels}
1122@opindex -lsp
1123@itemx --line-spacing=@var{pixels}
1124@opindex --line-spacing
1125@cindex line spacing, command-line argument
1126Specify @var{pixels} as additional space to put between lines, in pixels.
1127
1128@item -nbc
1129@opindex -nbc
1130@itemx --no-blinking-cursor
1131@opindex --no-blinking-cursor
1132@cindex blinking cursor disable, command-line argument
1133Disable the blinking cursor on graphical displays.
1134
1135@item -D
1136@opindex -D
1137@itemx --basic-display
1138@opindex --basic-display
1139Disable the menu-bar, the tool-bar, the scroll-bars, and tool tips,
1140and turn off the blinking cursor. This can be useful for making a
1141test case that simplifies debugging of display problems.
1142@end table
1143
1144 The @samp{--xrm} option (@pxref{Resources}) specifies additional
1145X resource values.