1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions.
4 @node Command Arguments, Antinews, Service, Top
5 @appendix Command Line Arguments
6 @cindex command line arguments
7 @cindex arguments (command line)
8 @cindex options (command line)
9 @cindex switches (command line)
10 @cindex startup (command line arguments)
12 GNU Emacs supports command line arguments to request various actions
13 when invoking Emacs. These are for compatibility with other editors and
14 for sophisticated activities. We don't recommend using them for
17 Arguments starting with @samp{-} are @dfn{options}. Other arguments
18 specify files to visit. Emacs visits the specified files while it
19 starts up. The last file name on your command line becomes the
20 current buffer; the other files are also visited in other buffers. If
21 there are two files, they are both displayed; otherwise the last file
22 is displayed along with a buffer list that shows what other buffers
23 there are. As with most programs, the special argument @samp{--} says
24 that all subsequent arguments are file names, not options, even if
25 they start with @samp{-}.
27 Emacs command options can specify many things, such as the size and
28 position of the X window Emacs uses, its colors, and so on. A few
29 options support advanced usage, such as running Lisp functions on files
30 in batch mode. The sections of this chapter describe the available
31 options, arranged according to their purpose.
33 There are two ways of writing options: the short forms that start with
34 a single @samp{-}, and the long forms that start with @samp{--}. For
35 example, @samp{-d} is a short form and @samp{--display} is the
36 corresponding long form.
38 The long forms with @samp{--} are easier to remember, but longer to
39 type. However, you don't have to spell out the whole option name; any
40 unambiguous abbreviation is enough. When a long option takes an
41 argument, you can use either a space or an equal sign to separate the
42 option name and the argument. Thus, you can write either
43 @samp{--display sugar-bombs:0.0} or @samp{--display=sugar-bombs:0.0}.
44 We recommend an equal sign because it makes the relationship clearer,
45 and the tables below always show an equal sign.
47 @cindex initial options (command line)
48 @cindex action options (command line)
49 Most options specify how to initialize Emacs, or set parameters for
50 the Emacs session. We call them @dfn{initial options}. A few options
51 specify things to do: for example, load libraries, call functions, or
52 exit Emacs. These are called @dfn{action options}. These and file
53 names together are called @dfn{action arguments}. Emacs processes all
54 the action arguments in the order they are written.
57 * Action Arguments:: Arguments to visit files, load libraries,
59 * Initial Options:: Arguments that take effect while starting Emacs.
60 * Command Example:: Examples of using command line arguments.
61 * Resume Arguments:: Specifying arguments when you resume a running Emacs.
62 * Environment:: Environment variables that Emacs uses.
64 * Display X:: Changing the default display and using remote login.
65 * Font X:: Choosing a font for text, under X.
66 * Colors X:: Choosing colors, under X.
67 * Window Size X:: Start-up window size, under X.
68 * Borders X:: Internal and external borders, under X.
69 * Title X:: Specifying the initial frame's title.
70 * Icons X:: Choosing what sort of icon to use, under X.
71 * Resources X:: Advanced use of classes and resources, under X.
72 * Lucid Resources:: X resources for Lucid menus.
73 * LessTif Resources:: X resources for LessTif and Motif menus.
76 @node Action Arguments
77 @appendixsec Action Arguments
79 Here is a table of the action arguments and options:
84 @itemx --visit=@var{file}
86 @itemx --file=@var{file}
87 @cindex visiting files, command-line argument
88 Visit @var{file} using @code{find-file}. @xref{Visiting}.
90 @item +@var{linenum} @var{file}
91 @opindex +@var{linenum}
92 Visit @var{file} using @code{find-file}, then go to line number
98 @itemx --load=@var{file}
100 @cindex loading Lisp libraries, command-line argument
101 Load a Lisp library named @var{file} with the function @code{load}.
102 @xref{Lisp Libraries}. The library can be found either in the current
103 directory, or in the Emacs library search path as specified
104 with @env{EMACSLOADPATH} (@pxref{General Variables}).
106 @item -f @var{function}
108 @itemx --funcall=@var{function}
110 @cindex call Lisp functions, command-line argument
111 Call Lisp function @var{function} with no arguments.
113 @item --eval=@var{expression}
115 @itemx --execute=@var{expression}
117 @cindex evaluate expression, command-line argument
118 Evaluate Lisp expression @var{expression}.
120 @item --insert=@var{file}
122 @cindex insert file contents, command-line argument
123 Insert the contents of @var{file} into the current buffer. This is like
124 what @kbd{M-x insert-file} does. @xref{Misc File Ops}.
128 Exit from Emacs without asking for confirmation.
131 @vindex command-line-args
132 The init file can access the values of the action arguments as the
133 elements of a list in the variable @code{command-line-args}. The init
134 file can override the normal processing of the action arguments, or
135 define new ones, by reading and setting this variable.
137 @node Initial Options
138 @appendixsec Initial Options
140 The initial options specify parameters for the Emacs session. This
141 section describes the more general initial options; some other options
142 specifically related to the X Window System appear in the following
145 Some initial options affect the loading of init files. The normal
146 actions of Emacs are to first load @file{site-start.el} if it exists,
147 then your own init file @file{~/.emacs} if it exists, and finally
148 @file{default.el} if it exists; certain options prevent loading of some
149 of these files or substitute other files for them.
152 @item -t @var{device}
154 @itemx --terminal=@var{device}
156 @cindex device for Emacs terminal I/O
157 Use @var{device} as the device for terminal input and output.
159 @item -d @var{display}
161 @itemx --display=@var{display}
163 @cindex display for Emacs frame
164 Use the X Window System and use the display named @var{display} to open
165 the initial Emacs frame. @xref{Display X}, for more details.
170 @opindex --no-windows
171 @cindex disable window system
172 Don't communicate directly with the window system, disregarding the
173 @env{DISPLAY} environment variable even if it is set. This forces Emacs
174 to run as if the display were a text-only terminal.
181 Run Emacs in @dfn{batch mode}, which means that the text being edited is
182 not displayed and the standard terminal interrupt characters such as
183 @kbd{C-z} and @kbd{C-c} continue to have their normal effect. Emacs in
184 batch mode outputs to @code{stderr} only what would normally be printed
185 in the echo area under program control, and functions which would
186 normally read from the minibuffer take their input from @code{stdin}.
188 Batch mode is used for running programs written in Emacs Lisp from
189 shell scripts, makefiles, and so on. Normally the @samp{-l} option
190 or @samp{-f} option will be used as well, to invoke a Lisp program
191 to do the batch processing.
193 @samp{-batch} implies @samp{-q} (do not load an init file). It also causes
194 Emacs to kill itself after all command options have been processed. In
195 addition, auto-saving is not done except in buffers for which it has been
196 explicitly requested.
200 @itemx --no-init-file
201 @opindex --no-init-file
202 @cindex bypassing init and site-start file
203 @cindex init file, not loading
204 @cindex @file{default.el} file, not loading
205 Do not load your Emacs init file @file{~/.emacs}, or @file{default.el}
206 either. When invoked like this, Emacs does not allow to save options
207 changed with the @kbd{M-x customize} command and its variants.
208 @xref{Easy Customization}.
211 @opindex --no-site-file
212 @cindex @file{site-start.el} file, not loading
213 Do not load @file{site-start.el}. The options @samp{-q}, @samp{-u}
214 and @samp{-batch} have no effect on the loading of this file---this is
215 the only option that blocks it.
219 @itemx --user=@var{user}
221 @cindex load init file of another user
222 Load @var{user}'s Emacs init file @file{~@var{user}/.emacs} instead of
226 @opindex --debug-init
227 @cindex errors in init file
228 Enable the Emacs Lisp debugger for errors in the init file.
232 @cindex unibyte operation, command-line argument
233 Set up to do almost everything with single-byte buffers and strings.
234 All buffers and strings are unibyte unless you (or a Lisp program)
235 explicitly ask for a multibyte buffer or string. (Note that Emacs
236 always loads Lisp files in multibyte mode, even if @samp{--unibyte} is
237 specified; see @ref{Enabling Multibyte}.) Setting the environment
238 variable @env{EMACS_UNIBYTE} has the same effect.
242 Inhibit the effect of @env{EMACS_UNIBYTE}, so that Emacs
243 uses multibyte characters by default, as usual.
246 @node Command Example
247 @appendixsec Command Argument Example
249 Here is an example of using Emacs with arguments and options. It
250 assumes you have a Lisp program file called @file{hack-c.el} which, when
251 loaded, performs some useful operation on the current buffer, expected
255 emacs -batch foo.c -l hack-c -f save-buffer >& log
259 This says to visit @file{foo.c}, load @file{hack-c.el} (which makes
260 changes in the visited file), save @file{foo.c} (note that
261 @code{save-buffer} is the function that @kbd{C-x C-s} is bound to), and
262 then exit back to the shell (because of @samp{-batch}). @samp{-batch}
263 also guarantees there will be no problem redirecting output to
264 @file{log}, because Emacs will not assume that it has a display terminal
267 @node Resume Arguments
268 @appendixsec Resuming Emacs with Arguments
270 You can specify action arguments for Emacs when you resume it after
271 a suspension. To prepare for this, put the following code in your
272 @file{.emacs} file (@pxref{Hooks}):
274 @c `resume-suspend-hook' is correct. It is the name of a function.
276 (add-hook 'suspend-hook 'resume-suspend-hook)
277 (add-hook 'suspend-resume-hook 'resume-process-args)
280 As further preparation, you must execute the shell script
281 @file{emacs.csh} (if you use csh as your shell) or @file{emacs.bash}
282 (if you use bash as your shell). These scripts define an alias named
283 @code{edit}, which will resume Emacs giving it new command line
284 arguments such as files to visit. The scripts are found in the
285 @file{etc} subdirectory of the Emacs distribution.
287 Only action arguments work properly when you resume Emacs. Initial
288 arguments are not recognized---it's too late to execute them anyway.
290 Note that resuming Emacs (with or without arguments) must be done from
291 within the shell that is the parent of the Emacs job. This is why
292 @code{edit} is an alias rather than a program or a shell script. It is
293 not possible to implement a resumption command that could be run from
294 other subjobs of the shell; no way to define a command that could be
295 made the value of @env{EDITOR}, for example. Therefore, this feature
296 does not take the place of the Emacs Server feature (@pxref{Emacs
299 The aliases use the Emacs Server feature if you appear to have a
300 server Emacs running. However, they cannot determine this with complete
301 accuracy. They may think that a server is still running when in
302 actuality you have killed that Emacs, because the file
303 @file{/tmp/esrv@dots{}} still exists. If this happens, find that
307 @appendixsec Environment Variables
308 @cindex environment variables
310 The @dfn{environment} is a feature of the operating system; it
311 consists of a collection of variables with names and values. Each
312 variable is called an @dfn{environment variable}; environment variable
313 names are case-sensitive, and it is conventional to use upper case
314 letters only. The values are all text strings.
316 What makes the environment useful is that subprocesses inherit the
317 environment automatically from their parent process. This means you
318 can set up an environment variable in your login shell, and all the
319 programs you run (including Emacs) will automatically see it.
320 Subprocesses of Emacs (such as shells, compilers, and version-control
321 software) inherit the environment from Emacs, too.
325 Inside Emacs, the command @kbd{M-x getenv} gets the value of an
326 environment variable. @kbd{M-x setenv} sets a variable in the Emacs
327 environment. The way to set environment variables outside of Emacs
328 depends on the operating system, and especially the shell that you are
329 using. For example, here's how to set the environment variable
330 @env{ORGANIZATION} to @samp{not very much} using Bash:
333 export ORGANIZATION="not very much"
337 and here's how to do it in csh or tcsh:
340 setenv ORGANIZATION "not very much"
343 When Emacs is set-up to use the X Window System, it inherits the use
344 of a large number of environment variables from the X libraries. See
345 the X documentation for more information.
348 * General Variables:: Environment variables that all versions of Emacs use.
349 * Misc Variables:: Certain system-specific variables.
352 @node General Variables
353 @appendixsubsec General Variables
355 Here is an alphabetical list of specific environment variables that
356 have special meanings in Emacs, giving the name of each variable and
357 its meaning. Most of these variables are also used by some other
358 programs. Emacs does not require any of these environment variables
359 to be set, but it uses their values if they are set.
363 Used by the @code{cd} command to search for the directory you specify,
364 when you specify a relative directory name.
366 @cindex unibyte operation, environment variable
367 Defining this environment variable with a nonempty value directs Emacs
368 to do almost everything with single-byte buffers and strings. It is
369 equivalent to using the @samp{--unibyte} command-line option on each
370 invocation. @xref{Initial Options}.
372 Directory for the architecture-independent files that come with Emacs.
373 This is used to initialize the Lisp variable @code{data-directory}.
375 Directory for the documentation string file,
376 @file{DOC-@var{emacsversion}}. This is used to initialize the Lisp
377 variable @code{doc-directory}.
379 A colon-separated list of directories@footnote{
380 Here and below, whenever we say ``colon-separated list of directories'',
381 it pertains to Unix and GNU/Linux systems. On MS-DOS and MS-Windows,
382 the directories are separated by semi-colons instead, since DOS/Windows
383 file names might include a colon after a drive letter.}
384 to search for Emacs Lisp files---used to initialize @code{load-path}.
386 A colon-separated list of directories to search for executable
387 files---used to initialize @code{exec-path}.
389 Used for shell-mode to override the @env{SHELL} environment variable.
391 The name of the file that shell commands are saved in between logins.
392 This variable defaults to @file{~/.bash_history} if you use Bash, to
393 @file{~/.sh_history} if you use ksh, and to @file{~/.history}
396 The location of the user's files in the directory tree; used for
397 expansion of file names starting with a tilde (@file{~}). On MS-DOS, it
398 defaults to the directory from which Emacs was started, with @samp{/bin}
399 removed from the end if it was present. On Windows, the default value
400 of @code{HOME} is @file{C:/}, the root directory of drive @file{C:}.
402 The name of the machine that Emacs is running on.
404 A colon-separated list of directories. Used by the @code{complete} package
407 A colon-separated list of directories in which to search for Info files.
416 The user's preferred locale. The locale has six categories, specified
417 by the environment variables @env{LC_COLLATE} for sorting,
418 @env{LC_CTYPE} for character encoding, @env{LC_MESSAGES} for system
419 messages, @env{LC_MONETARY} for monetary formats, @env{LC_NUMERIC} for
420 numbers, and @env{LC_TIME} for dates and times. If one of these
421 variables is not set, the category defaults to the value of the
422 @env{LANG} environment variable, or to the default @samp{C} locale if
423 @env{LANG} is not set. But if @env{LC_ALL} is specified, it overrides
424 the settings of all the other locale environment variables.
426 The value of the LC_CTYPE category is
427 matched against entries in @code{locale-language-names},
428 @code{locale-charset-language-names}, and
429 @code{locale-preferred-coding-systems}, to select a default language
430 environment and coding system. @xref{Language Environments}.
432 The user's login name. See also @env{USER}.
434 The name of the user's system mail inbox.
436 Name of file containing mail aliases. (The default is
439 Name of setup file for the mh system. (The default is @file{~/.mh_profile}.)
441 The real-world name of the user.
443 The name of the news server. Used by the mh and Gnus packages.
445 The name of the organization to which you belong. Used for setting the
446 `Organization:' header in your posts from the Gnus package.
448 A colon-separated list of directories in which executables reside. This
449 is used to initialize the Emacs Lisp variable @code{exec-path}.
451 If set, this should be the default directory when Emacs was started.
453 If set, this specifies an initial value for the variable
454 @code{mail-default-reply-to}. @xref{Mail Headers}.
456 The name of a directory in which news articles are saved by default.
457 Used by the Gnus package.
459 The name of an interpreter used to parse and execute programs run from
461 @cindex background mode, on @code{xterm}
463 The name of the terminal that Emacs is running on. The variable must be
464 set unless Emacs is run in batch mode. On MS-DOS, it defaults to
465 @samp{internal}, which specifies a built-in terminal emulation that
466 handles the machine's own display. If the value of @env{TERM} indicates
467 that Emacs runs in non-windowed mode from @code{xterm} or a similar
468 terminal emulator, the background mode defaults to @samp{light}, and
469 Emacs will choose colors that are appropriate for a light background.
471 The name of the termcap library file describing how to program the
472 terminal specified by the @env{TERM} variable. This defaults to
475 Used by the Emerge package as a prefix for temporary files.
477 This specifies the current time zone and possibly also daylight
478 saving time information. On MS-DOS, if @code{TZ} is not set in the
479 environment when Emacs starts, Emacs defines a default value as
480 appropriate for the country code returned by DOS. On MS-Windows, Emacs
481 does not use @code{TZ} at all.
483 The user's login name. See also @env{LOGNAME}. On MS-DOS, this
484 defaults to @samp{root}.
485 @item VERSION_CONTROL
486 Used to initialize the @code{version-control} variable (@pxref{Backup
491 @appendixsubsec Miscellaneous Variables
493 These variables are used only on particular configurations:
497 On MS-DOS and MS-Windows, the name of the command interpreter to use
498 when invoking batch files and commands internal to the shell. On MS-DOS
499 this is also used to make a default value for the @env{SHELL} environment
503 On MS-DOS, this variable defaults to the value of the @env{USER}
508 On MS-DOS and MS-Windows, these specify the name of the directory for
509 storing temporary files in.
512 On MS-DOS, this specifies a file to use to log the operation of the
513 internal terminal emulator. This feature is useful for submitting bug
517 On MS-DOS, this specifies the screen colors. It is useful to set them
518 this way, since otherwise Emacs would display the default colors
519 momentarily when it starts up.
521 The value of this variable should be the two-character encoding of the
522 foreground (the first character) and the background (the second
523 character) colors of the default face. Each character should be the
524 hexadecimal code for the desired color on a standard PC text-mode
525 display. For example, to get blue text on a lightgray backgraound,
526 specify @samp{EMACSCOLORS=17}, since 1 is the code of the blue color and
527 7 is the code of the lightgray color.
529 The PC display usually supports only eight background colors. However,
530 Emacs switches the DOS display to a mode where all 16 colors can be used
531 for the background, so all four bits of the background color are
535 Used when initializing the Sun windows system.
539 @appendixsec Specifying the Display Name
540 @cindex display name (X Window System)
541 @cindex @env{DISPLAY} environment variable
543 The environment variable @env{DISPLAY} tells all X clients, including
544 Emacs, where to display their windows. Its value is set up by default
545 in ordinary circumstances, when you start an X server and run jobs
546 locally. Occasionally you may need to specify the display yourself; for
547 example, if you do a remote login and want to run a client program
548 remotely, displaying on your local screen.
550 With Emacs, the main reason people change the default display is to
551 let them log into another system, run Emacs on that system, but have the
552 window displayed at their local terminal. You might need to log in
553 to another system because the files you want to edit are there, or
554 because the Emacs executable file you want to run is there.
556 The syntax of the @env{DISPLAY} environment variable is
557 @samp{@var{host}:@var{display}.@var{screen}}, where @var{host} is the
558 host name of the X Window System server machine, @var{display} is an
559 arbitrarily-assigned number that distinguishes your server (X terminal)
560 from other servers on the same machine, and @var{screen} is a
561 rarely-used field that allows an X server to control multiple terminal
562 screens. The period and the @var{screen} field are optional. If
563 included, @var{screen} is usually zero.
565 For example, if your host is named @samp{glasperle} and your server is
566 the first (or perhaps the only) server listed in the configuration, your
567 @env{DISPLAY} is @samp{glasperle:0.0}.
569 You can specify the display name explicitly when you run Emacs, either
570 by changing the @env{DISPLAY} variable, or with the option @samp{-d
571 @var{display}} or @samp{--display=@var{display}}. Here is an example:
574 emacs --display=glasperle:0 &
577 You can inhibit the direct use of the window system and GUI with the
578 @samp{-nw} option. It tells Emacs to display using ordinary ASCII on
579 its controlling terminal. This is also an initial option.
581 Sometimes, security arrangements prevent a program on a remote system
582 from displaying on your local system. In this case, trying to run Emacs
583 produces messages like this:
586 Xlib: connection to "glasperle:0.0" refused by server
590 You might be able to overcome this problem by using the @code{xhost}
591 command on the local system to give permission for access from your
595 @appendixsec Font Specification Options
596 @cindex font name (X Window System)
598 By default, Emacs displays text in the font named @samp{9x15}, which
599 makes each character nine pixels wide and fifteen pixels high. You can
600 specify a different font on your command line through the option
601 @samp{-fn @var{name}} (or @samp{--font}, which is an alias for
607 @itemx --font=@var{name}
609 @cindex specify default font from the command line
610 Use font @var{name} as the default font.
613 Under X, each font has a long name which consists of eleven words or
614 numbers, separated by dashes. Some fonts also have shorter
615 nicknames---@samp{9x15} is such a nickname. You can use either kind of
616 name. You can use wildcard patterns for the font name; then Emacs lets
617 X choose one of the fonts that match the pattern. Here is an example,
618 which happens to specify the font whose nickname is @samp{6x13}:
621 emacs -fn "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1" &
625 You can also specify the font in your @file{.Xdefaults} file:
628 emacs.font: -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
631 A long font name has the following form:
634 -@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
635 @dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{charset}
640 This is the name of the font manufacturer.
642 This is the name of the font family---for example, @samp{courier}.
644 This is normally @samp{bold}, @samp{medium} or @samp{light}. Other
645 words may appear here in some font names.
647 This is @samp{r} (roman), @samp{i} (italic), @samp{o} (oblique),
648 @samp{ri} (reverse italic), or @samp{ot} (other).
650 This is normally @samp{condensed}, @samp{extended}, @samp{semicondensed}
651 or @samp{normal}. Other words may appear here in some font names.
653 This is an optional additional style name. Usually it is empty---most
654 long font names have two hyphens in a row at this point.
656 This is the font height, in pixels.
658 This is the font height on the screen, measured in tenths of a printer's
659 point---approximately 1/720 of an inch. In other words, it is the point
660 size of the font, times ten. For a given vertical resolution,
661 @var{height} and @var{pixels} are proportional; therefore, it is common
662 to specify just one of them and use @samp{*} for the other.
664 This is the horizontal resolution, in pixels per inch, of the screen for
665 which the font is intended.
667 This is the vertical resolution, in pixels per inch, of the screen for
668 which the font is intended. Normally the resolution of the fonts on
669 your system is the right value for your screen; therefore, you normally
670 specify @samp{*} for this and @var{horiz}.
672 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
675 This is the average character width, in pixels, multiplied by ten.
677 This is the character set that the font depicts.
678 Normally you should use @samp{iso8859-1}.
681 @cindex listing system fonts
682 You will probably want to use a fixed-width default font---that is,
683 a font in which all characters have the same width. Any font with
684 @samp{m} or @samp{c} in the @var{spacing} field of the long name is a
685 fixed-width font. Here's how to use the @code{xlsfonts} program to
686 list all the fixed-width fonts available on your system:
689 xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
690 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
691 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
695 To see what a particular font looks like, use the @code{xfd} command.
703 displays the entire font @samp{6x13}.
705 While running Emacs, you can set the font of the current frame
706 (@pxref{Frame Parameters}) or for a specific kind of text
710 @appendixsec Window Color Options
711 @cindex color of window
712 @cindex text colors, from command line
714 @findex list-colors-display
715 @cindex available colors
716 On a color display, you can specify which color to use for various
717 parts of the Emacs display. To find out what colors are available on
718 your system, type @kbd{M-x list-colors-display}, or press
719 @kbd{C-Mouse-2} and select @samp{Display Colors} from the pop-up menu.
720 If you do not specify colors, on windowed displays the default for the
721 background is white and the default for all other colors is black. On a
722 monochrome display, the foreground is black, the background is white,
723 and the border is gray if the display supports that. On terminals, the
724 background is usually black and the foreground is white.
726 Here is a list of the command-line options for specifying colors:
729 @item -fg @var{color}
731 @itemx --foreground-color=@var{color}
732 @opindex --foreground-color
733 @cindex foreground color, command-line argument
734 Specify the foreground color. @var{color} should be a standard color
735 name, or a numeric specification of the color's red, green, and blue
736 components as in @samp{#4682B4} or @samp{RGB:46/82/B4}.
737 @item -bg @var{color}
739 @itemx --background-color=@var{color}
740 @opindex --background-color
741 @cindex background color, command-line argument
742 Specify the background color.
743 @item -bd @var{color}
745 @itemx --border-color=@var{color}
746 @opindex --border-color
747 @cindex border color, command-line argument
748 Specify the color of the border of the X window.
749 @item -cr @var{color}
751 @itemx --cursor-color=@var{color}
752 @opindex --cursor-color
753 @cindex cursor color, command-line argument
754 Specify the color of the Emacs cursor which indicates where point is.
755 @item -ms @var{color}
757 @itemx --mouse-color=@var{color}
758 @opindex --mouse-color
759 @cindex mouse pointer color, command-line argument
760 Specify the color for the mouse cursor when the mouse is in the Emacs window.
765 @itemx --reverse-video
766 @opindex --reverse-video
767 @cindex reverse video, command-line argument
768 Reverse video---swap the foreground and background colors.
771 For example, to use a coral mouse cursor and a slate blue text cursor,
775 emacs -ms coral -cr 'slate blue' &
778 You can reverse the foreground and background colors through the
779 @samp{-rv} option or with the X resource @samp{reverseVideo}.
781 The @samp{-fg}, @samp{-bg}, and @samp{-rv} options function on
782 text-only terminals as well as on window systems.
785 @appendixsec Options for Window Geometry
786 @cindex geometry of Emacs window
787 @cindex position and size of Emacs frame
789 The @samp{-geometry} option controls the size and position of the
790 initial Emacs frame. Here is the format for specifying the window
794 @item -g @var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
796 Specify window size @var{width} and @var{height} (measured in character
797 columns and lines), and positions @var{xoffset} and @var{yoffset}
798 (measured in pixels).
800 @item --geometry=@var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
802 This is another way of writing the same thing.
806 @code{@r{@{}+-@r{@}}} means either a plus sign or a minus sign. A plus
807 sign before @var{xoffset} means it is the distance from the left side of
808 the screen; a minus sign means it counts from the right side. A plus
809 sign before @var{yoffset} means it is the distance from the top of the
810 screen, and a minus sign there indicates the distance from the bottom.
811 The values @var{xoffset} and @var{yoffset} may themselves be positive or
812 negative, but that doesn't change their meaning, only their direction.
814 Emacs uses the same units as @code{xterm} does to interpret the geometry.
815 The @var{width} and @var{height} are measured in characters, so a large font
816 creates a larger frame than a small font. (If you specify a proportional
817 font, Emacs uses its maximum bounds width as the width unit.) The
818 @var{xoffset} and @var{yoffset} are measured in pixels.
820 Since the mode line and the echo area occupy the last 2 lines of the
821 frame, the height of the initial text window is 2 less than the height
822 specified in your geometry. In non-X-toolkit versions of Emacs, the
823 menu bar also takes one line of the specified number. But in the X
824 toolkit version, the menu bar is additional and does not count against
825 the specified height. The tool bar, if present, is also additional.
827 You do not have to specify all of the fields in the geometry
830 If you omit both @var{xoffset} and @var{yoffset}, the window manager
831 decides where to put the Emacs frame, possibly by letting you place
832 it with the mouse. For example, @samp{164x55} specifies a window 164
833 columns wide, enough for two ordinary width windows side by side, and 55
836 The default width for Emacs is 80 characters and the default height is
837 40 lines. You can omit either the width or the height or both. If
838 you start the geometry with an integer, Emacs interprets it as the
839 width. If you start with an @samp{x} followed by an integer, Emacs
840 interprets it as the height. Thus, @samp{81} specifies just the width;
841 @samp{x45} specifies just the height.
843 If you start with @samp{+} or @samp{-}, that introduces an offset,
844 which means both sizes are omitted. Thus, @samp{-3} specifies the
845 @var{xoffset} only. (If you give just one offset, it is always
846 @var{xoffset}.) @samp{+3-3} specifies both the @var{xoffset} and the
847 @var{yoffset}, placing the frame near the bottom left of the screen.
849 You can specify a default for any or all of the fields in
850 @file{.Xdefaults} file, and then override selected fields with a
851 @samp{--geometry} option.
854 @appendixsec Internal and External Borders
855 @cindex borders (X Window System)
857 An Emacs frame has an internal border and an external border. The
858 internal border is an extra strip of the background color around the
859 text portion of the frame. Emacs itself draws the internal border.
860 The external border is added by the window manager outside the frame;
861 depending on the window manager you use, it may contain various boxes
862 you can click on to move or iconify the window.
865 @item -ib @var{width}
867 @itemx --internal-border=@var{width}
868 @opindex --internal-border
869 @cindex border width, command-line argument
870 Specify @var{width} as the width of the internal border, in pixels.
872 @item -bw @var{width}
874 @itemx --border-width=@var{width}
875 @opindex --border-width
876 Specify @var{width} as the width of the main border, in pixels.
879 When you specify the size of the frame, that does not count the
880 borders. The frame's position is measured from the outside edge of the
883 Use the @samp{-ib @var{n}} option to specify an internal border
884 @var{n} pixels wide. The default is 1. Use @samp{-bw @var{n}} to
885 specify the width of the external border (though the window manager may
886 not pay attention to what you specify). The default width of the
887 external border is 2.
890 @appendixsec Frame Titles
892 An Emacs frame may or may not have a specified title. The frame
893 title, if specified, appears in window decorations and icons as the
894 name of the frame. If an Emacs frame has no specified title, the
895 default title has the form @samp{@var{invocation-name}@@@var{machine}}
896 (if there is only one frame) or the selected window's buffer name (if
897 there is more than one frame).
899 You can specify a title for the initial Emacs frame with a command
903 @item -title @var{title}
905 @itemx --title=@var{title}
906 @itemx -T @var{title}
908 @cindex frame title, command-line argument
909 Specify @var{title} as the title for the initial Emacs frame.
912 The @samp{--name} option (@pxref{Resources X}) also specifies the title
913 for the initial Emacs frame.
917 @cindex icons (X Window System)
919 Most window managers allow the user to ``iconify'' a frame, removing
920 it from sight, and leaving a small, distinctive ``icon'' window in its
921 place. Clicking on the icon window makes the frame itself appear again.
922 If you have many clients running at once, you can avoid cluttering up
923 the screen by iconifying most of the clients.
930 @cindex Emacs icon, a gnu
931 Use a picture of a gnu as the Emacs icon.
936 @cindex start iconified, command-line argument
937 Start Emacs in iconified state.
940 The @samp{-i} or @samp{--icon-type} option tells Emacs to use an icon
941 window containing a picture of the GNU gnu. If omitted, Emacs lets the
942 window manager choose what sort of icon to use---usually just a small
943 rectangle containing the frame's title.
945 The @samp{-iconic} option tells Emacs to begin running as an icon,
946 rather than showing a frame right away. In this situation, the icon
947 is the only indication that Emacs has started; the text frame doesn't
948 appear until you deiconify it.
951 @appendixsec X Resources
954 Programs running under the X Window System organize their user options
955 under a hierarchy of classes and resources. You can specify default
956 values for these options in your X resources file, usually named
959 Each line in the file specifies a value for one option or for a
960 collection of related options, for one program or for several programs
961 (optionally even for all programs).
963 @cindex Registry (MS-Windows)
964 MS-Windows systems don't support @file{~/.Xdefaults} files, but
965 Emacs compiled for Windows looks for X resources in the Windows
966 Registry, under the keys @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
967 and @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
969 Programs define named resources with particular meanings. They also
970 define how to group resources into named classes. For instance, in
971 Emacs, the @samp{internalBorder} resource controls the width of the
972 internal border, and the @samp{borderWidth} resource controls the width
973 of the external border. Both of these resources are part of the
974 @samp{BorderWidth} class. Case distinctions are significant in these
977 In @file{~/.Xdefaults}, you can specify a value for a single resource
978 on one line, like this:
985 Or you can use a class name to specify the same value for all resources
986 in that class. Here's an example:
992 If you specify a value for a class, it becomes the default for all
993 resources in that class. You can specify values for individual
994 resources as well; these override the class value, for those particular
995 resources. Thus, this example specifies 2 as the default width for all
996 borders, but overrides this value with 4 for the external border:
1000 emacs.borderWidth: 4
1003 The order in which the lines appear in the file does not matter.
1004 Also, command-line options always override the X resources file.
1006 The string @samp{emacs} in the examples above is also a resource
1007 name. It actually represents the name of the executable file that you
1008 invoke to run Emacs. If Emacs is installed under a different name, it
1009 looks for resources under that name instead of @samp{emacs}.
1012 @item -name @var{name}
1014 @itemx --name=@var{name}
1015 @cindex resource name, command-line argument
1016 Use @var{name} as the resource name (and the title) for the initial
1017 Emacs frame. This option does not affect subsequent frames, but Lisp
1018 programs can specify frame names when they create frames.
1020 If you don't specify this option, the default is to use the Emacs
1021 executable's name as the resource name.
1023 @item -xrm @var{resource-values}
1025 @itemx --xrm=@var{resource-values}
1026 @cindex resource values, command-line argument
1027 Specify X resource values for this Emacs job (see below).
1030 For consistency, @samp{-name} also specifies the name to use for
1031 other resource values that do not belong to any particular frame.
1033 The resources that name Emacs invocations also belong to a class; its
1034 name is @samp{Emacs}. If you write @samp{Emacs} instead of
1035 @samp{emacs}, the resource applies to all frames in all Emacs jobs,
1036 regardless of frame titles and regardless of the name of the executable
1037 file. Here is an example:
1040 Emacs.BorderWidth: 2
1041 Emacs.borderWidth: 4
1044 You can specify a string of additional resource values for Emacs to
1045 use with the command line option @samp{-xrm @var{resources}}. The text
1046 @var{resources} should have the same format that you would use inside a file
1047 of X resources. To include multiple resource specifications in
1048 @var{resources}, put a newline between them, just as you would in a file.
1049 You can also use @samp{#include "@var{filename}"} to include a file full
1050 of resource specifications. Resource values specified with @samp{-xrm}
1051 take precedence over all other resource specifications.
1053 The following table lists the resource names that designate options
1054 for Emacs, each with the class that it belongs to:
1057 @item @code{background} (class @code{Background})
1058 Background color name.
1060 @item @code{bitmapIcon} (class @code{BitmapIcon})
1061 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
1062 manager choose an icon if @samp{off}.
1064 @item @code{borderColor} (class @code{BorderColor})
1065 Color name for the external border.
1067 @item @code{borderWidth} (class @code{BorderWidth})
1068 Width in pixels of the external border.
1070 @item @code{cursorColor} (class @code{Foreground})
1071 Color name for text cursor (point).
1073 @item @code{font} (class @code{Font})
1074 Font name for text (or fontset name, @pxref{Fontsets}).
1076 @item @code{foreground} (class @code{Foreground})
1077 Color name for text.
1079 @item @code{geometry} (class @code{Geometry})
1080 Window size and position. Be careful not to specify this resource as
1081 @samp{emacs*geometry}, because that may affect individual menus as well
1082 as the Emacs frame itself.
1084 If this resource specifies a position, that position applies only to the
1085 initial Emacs frame (or, in the case of a resource for a specific frame
1086 name, only that frame). However, the size if specified here applies to
1089 @item @code{iconName} (class @code{Title})
1090 Name to display in the icon.
1092 @item @code{internalBorder} (class @code{BorderWidth})
1093 Width in pixels of the internal border.
1095 @item @code{lineSpacing} (class LineSpacing)
1096 @cindex line spacing
1098 Additional space (@dfn{leading}) between lines, in pixels.
1100 @item @code{menuBar} (class @code{MenuBar})
1101 Give frames menu bars if @samp{on}; don't have menu bars if @samp{off}.
1103 @item @code{toolBar} (class @code{ToolBar})
1104 Number of lines to reserve for the tool bar. A zero value suppresses
1105 the tool bar. If the value is non-zero and
1106 @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
1107 will be changed automatically so that all tool bar items are visible.
1109 @item @code{minibuffer} (class @code{Minibuffer})
1110 If @samp{none}, don't make a minibuffer in this frame.
1111 It will use a separate minibuffer frame instead.
1113 @item @code{paneFont} (class @code{Font})
1114 @cindex font for menus
1115 Font name for menu pane titles, in non-toolkit versions of Emacs.
1117 @item @code{pointerColor} (class @code{Foreground})
1118 Color of the mouse cursor.
1121 @item @code{privateColormap} (class @code{PrivateColormap})
1122 If @samp{on}, use a private colormap, in the case where the ``default
1123 visual'' of class PseudoColor and Emacs is using it.
1126 @item @code{reverseVideo} (class @code{ReverseVideo})
1127 Switch foreground and background default colors if @samp{on}, use colors as
1128 specified if @samp{off}.
1130 @item @code{screenGamma} (class @code{ScreenGamma})
1131 @cindex gamma correction
1132 Gamma correction for colors, equivalent to the frame parameter
1133 @code{screen-gamma}.
1135 @item @code{selectionFont} (class @code{Font})
1136 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
1137 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
1140 @item @code{synchronous} (class @code{Synchronous})
1141 @cindex debugging X problems
1142 @cindex synchronous X mode
1143 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
1144 useful for debugging X problems.
1146 @item @code{title} (class @code{Title})
1147 Name to display in the title bar of the initial Emacs frame.
1149 @item @code{verticalScrollBars} (class @code{ScrollBars})
1150 Give frames scroll bars if @samp{on}; don't have scroll bars if
1154 Here are resources for controlling the appearance of particular faces
1158 @item @var{face}.attributeFont
1159 Font for face @var{face}.
1160 @item @var{face}.attributeForeground
1161 Foreground color for face @var{face}.
1162 @item @var{face}.attributeBackground
1163 Background color for face @var{face}.
1164 @item @var{face}.attributeUnderline
1165 Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
1169 @node Lucid Resources
1170 @section Lucid Menu X Resources
1171 @cindex Menu X Resources (Lucid widgets)
1172 @cindex Lucid Widget X Resources
1174 If the Emacs installed at your site was built to use the X toolkit
1175 with the Lucid menu widgets, then the menu bar is a separate widget and
1176 has its own resources. The resource names contain @samp{pane.menubar}
1177 (following, as always, the name of the Emacs invocation or @samp{Emacs}
1178 which stands for all Emacs invocations). Specify them like this:
1181 Emacs.pane.menubar.@var{resource}: @var{value}
1185 For example, to specify the font @samp{8x16} for the menu-bar items,
1189 Emacs.pane.menubar.font: 8x16
1193 Resources for @emph{non-menubar} toolkit pop-up menus have
1194 @samp{menu*}, in like fashion. For example, to specify the font
1195 @samp{8x16} for the pop-up menu items, write this:
1198 Emacs.menu*.font: 8x16
1202 For dialog boxes, use @samp{dialog} instead of @samp{menu}:
1205 Emacs.dialog*.font: 8x16
1209 Experience shows that on some systems you may need to add
1210 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
1211 some other systems, you must not add @samp{shell.}.
1213 Here is a list of the specific resources for menu bars and pop-up menus:
1217 Font for menu item text.
1219 Color of the foreground.
1221 Color of the background.
1222 @item buttonForeground
1223 In the menu bar, the color of the foreground for a selected item.
1224 @item horizontalSpacing
1225 Horizontal spacing in pixels between items. Default is 3.
1226 @item verticalSpacing
1227 Vertical spacing in pixels between items. Default is 1.
1229 Horizontal spacing between the arrow (which indicates a submenu) and
1230 the associated text. Default is 10.
1231 @item shadowThickness
1232 Thickness of shadow line around the widget.
1234 The margin of the menu bar, in characters. The default of 4 makes the
1235 menu bar appear like the LessTif/Motif one.
1238 @node LessTif Resources
1239 @section LessTif Menu X Resources
1240 @cindex Menu X Resources (LessTif widgets)
1241 @cindex LessTif Widget X Resources
1243 If the Emacs installed at your site was built to use the X toolkit
1244 with the LessTif or Motif widgets, then the menu bar is a separate
1245 widget and has its own resources. The resource names contain
1246 @samp{pane.menubar} (following, as always, the name of the Emacs
1247 invocation or @samp{Emacs} which stands for all Emacs invocations).
1248 Specify them like this:
1251 Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
1254 Each individual string in the menu bar is a subwidget; the subwidget's
1255 name is the same as the menu item string. For example, the word
1256 @samp{File} in the menu bar is part of a subwidget named
1257 @samp{emacs.pane.menubar.File}. Most likely, you want to specify the
1258 same resources for the whole menu bar. To do this, use @samp{*} instead
1259 of a specific subwidget name. For example, to specify the font
1260 @samp{8x16} for the menu-bar items, write this:
1263 Emacs.pane.menubar.*.fontList: 8x16
1267 This also specifies the resource value for submenus.
1269 Each item in a submenu in the menu bar also has its own name for X
1270 resources; for example, the @samp{File} submenu has an item named
1271 @samp{Save (current buffer)}. A resource specification for a submenu
1272 item looks like this:
1275 Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
1279 For example, here's how to specify the font for the @samp{Save (current
1283 Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
1287 For an item in a second-level submenu, such as @samp{Complete Word}
1288 under @samp{Spell Checking} under @samp{Tools}, the resource fits this
1292 Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
1299 Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
1303 (This should be one long line.)
1305 It's impossible to specify a resource for all the menu-bar items
1306 without also specifying it for the submenus as well. So if you want the
1307 submenu items to look different from the menu bar itself, you must ask
1308 for that in two steps. First, specify the resource for all of them;
1309 then, override the value for submenus alone. Here is an example:
1312 Emacs.pane.menubar.*.fontList: 8x16
1313 Emacs.pane.menubar.popup_*.fontList: 8x16
1317 For toolkit pop-up menus, use @samp{menu*} instead of
1318 @samp{pane.menubar}. For example, to specify the font @samp{8x16} for
1319 the pop-up menu items, write this:
1322 Emacs.menu*.fontList: 8x16
1328 Here is a list of the specific resources for menu bars and pop-up menus:
1332 The color to show in an armed button.
1341 Amount of space to leave around the item, within the border.
1343 The width of border around the menu item, on all sides.
1344 @item shadowThickness
1345 The width of the border shadow.
1346 @item bottomShadowColor
1347 The color for the border shadow, on the bottom and the right.
1348 @item topShadowColor
1349 The color for the border shadow, on the top and the left.