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