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
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
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}.
65 * Action Arguments:: Arguments to visit files, load libraries,
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.
81 @node Action Arguments
82 @appendixsec Action Arguments
84 Here is a table of the action arguments and options:
89 @itemx --file=@var{file}
91 @itemx --find-file=@var{file}
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
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}.
113 @itemx --load=@var{file}
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}).
124 @itemx --directory=@var{dir}
126 Add directory @var{dir} to the variable @code{load-path}.
128 @item -f @var{function}
130 @itemx --funcall=@var{function}
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}
140 @itemx --execute=@var{expression}
142 @cindex evaluate expression, command-line argument
143 Evaluate Lisp expression @var{expression}.
145 @item --insert=@var{file}
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}.
153 Exit from Emacs without asking for confirmation.
157 Print a usage message listing all available options, then exit
162 Print Emacs version, then exit successfully.
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
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
181 @item -t @var{device}
183 @itemx --terminal=@var{device}
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}
191 @itemx --display=@var{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.
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
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}
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
241 #!/usr/bin/emacs --script
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
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}.
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.
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.
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}.
285 @opindex --no-desktop
286 Do not reload any saved desktop. @xref{Saving Emacs Sessions}.
290 @itemx --user=@var{user}
292 @cindex load init file of another user
293 Load @var{user}'s Emacs init file @file{~@var{user}/.emacs} instead of
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}.
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}).
319 @opindex --no-unibyte
320 Inhibit the effect of @env{EMACS_UNIBYTE}, so that Emacs
321 uses multibyte characters by default, as usual.
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
333 emacs --batch foo.c -l hack-c -f save-buffer >& log
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
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.
354 (add-hook 'suspend-hook 'resume-suspend-hook)
355 (add-hook 'suspend-resume-hook 'resume-process-args)
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
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
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.
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:
414 export ORGANIZATION="not very much"
418 and here's how to do it in csh or tcsh:
421 setenv ORGANIZATION "not very much"
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.
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.
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.
445 Used by the @code{cd} command to search for the directory you specify,
446 when you specify a relative directory name.
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}.
454 Directory for the architecture-independent files that come with Emacs.
455 This is used to initialize the Lisp variable @code{data-directory}.
457 Directory for the documentation string file,
458 @file{DOC-@var{emacsversion}}. This is used to initialize the Lisp
459 variable @code{doc-directory}.
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}.
468 A colon-separated list of directories to search for executable
469 files---used to initialize @code{exec-path}.
471 Used for shell-mode to override the @env{SHELL} environment variable.
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}
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:}.
484 The name of the machine that Emacs is running on.
486 A colon-separated list of directories. Used by the @code{complete} package
489 A colon-separated list of directories in which to search for Info files.
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}.
519 The user's login name. See also @env{USER}.
521 The name of the user's system mail inbox.
523 Name of setup file for the mh system. (The default is @file{~/.mh_profile}.)
525 The real-world name of the user.
527 The name of the news server. Used by the mh and Gnus packages.
529 The name of the organization to which you belong. Used for setting the
530 `Organization:' header in your posts from the Gnus package.
532 A colon-separated list of directories in which executables reside. This
533 is used to initialize the Emacs Lisp variable @code{exec-path}.
535 If set, this should be the default directory when Emacs was started.
537 If set, this specifies an initial value for the variable
538 @code{mail-default-reply-to}. @xref{Mail Headers}.
540 The name of a directory in which news articles are saved by default.
541 Used by the Gnus package.
543 The name of an interpreter used to parse and execute programs run from
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}
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.
558 The name of the termcap library file describing how to program the
559 terminal specified by the @env{TERM} variable. This defaults to
562 Used by the Emerge package as a prefix for temporary files.
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.
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
578 @appendixsubsec Miscellaneous Variables
580 These variables are used only on particular configurations:
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
590 On MS-DOS, this variable defaults to the value of the @env{USER}
595 On MS-DOS and MS-Windows, these specify the name of the directory for
596 storing temporary files in.
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
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
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
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.
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.
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:
717 emacs --display=glasperle:0 &
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:
729 Xlib: connection to "glasperle:0.0" refused by server
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
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}).
749 @itemx --font=@var{name}
751 @cindex specify default font from the command line
752 Use font @var{name} as the default font.
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}:
771 "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1" &
775 You can also specify the font in your @file{.Xdefaults} file:
778 emacs.font: -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
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}
787 The default font used by Emacs (under X) is:
790 -adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1
793 A long font name has the following form:
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}
802 This is the name of the font manufacturer.
804 This is the name of the font family---for example, @samp{courier}.
806 This is normally @samp{bold}, @samp{medium} or @samp{light}. Other
807 words may appear here in some font names.
809 This is @samp{r} (roman), @samp{i} (italic), @samp{o} (oblique),
810 @samp{ri} (reverse italic), or @samp{ot} (other).
812 This is normally @samp{condensed}, @samp{extended}, @samp{semicondensed}
813 or @samp{normal}. Other words may appear here in some font names.
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.
818 This is the font height, in pixels.
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.
826 This is the horizontal resolution, in pixels per inch, of the screen for
827 which the font is intended.
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}.
834 This is @samp{m} (monospace), @samp{p} (proportional) or @samp{c}
837 This is the average character width, in pixels, multiplied by ten.
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}
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:
856 xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+"
857 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*'
858 xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
862 To see what a particular font looks like, use the @command{xfd} command.
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
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:
899 @item -fg @var{color}
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}
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}
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}
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}
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.
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}
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:
947 Don't use colors even if the terminal's capabilities specify color
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
957 Turn on the color support unconditionally, and use color commands
958 specified by the ANSI escape sequences for the 8 standard colors.
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
970 If @var{mode} is omitted, it defaults to @var{ansi8}.
973 For example, to use a coral mouse cursor and a slate blue text cursor,
977 emacs -ms coral -cr 'slate blue' &
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.
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:
997 @item -g @var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
999 @itemx --geometry=@var{width}x@var{height}@r{[@{}+-@r{@}}@var{xoffset}@r{@{}+-@r{@}}@var{yoffset}@r{]]}
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.
1009 @opindex --fullscreen
1010 @cindex fullscreen, command-line argument
1011 Specify that width and height shall be the size of the screen.
1016 @opindex --fullheight
1017 @cindex fullheight, command-line argument
1018 Specify that the height shall be the height of the screen.
1023 @opindex --fullwidth
1024 @cindex fullwidth, command-line argument
1025 Specify that the width shall be the width of the screen.
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.
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.
1107 @item -ib @var{width}
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}
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.
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
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.
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
1147 @item -T @var{title}
1149 @itemx --title=@var{title}
1151 @cindex frame title, command-line argument
1152 Specify @var{title} as the title for the initial Emacs frame.
1155 The @samp{--name} option (@pxref{Resources}) also specifies the title
1156 for the initial Emacs frame.
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.
1172 @opindex --icon-type
1173 @cindex Emacs icon, a gnu
1174 Use a picture of a gnu as the Emacs icon.
1179 @cindex start iconified, command-line argument
1180 Start Emacs in iconified state.
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.
1194 @appendixsec Other Display Options
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.
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}
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.
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.
1227 The @samp{--xrm} option (@pxref{Resources}) specifies additional
1231 arch-tag: fffecd9e-7329-4a51-a3cc-dd4a9889340e