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