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