diff options
| author | Chong Yidong | 2008-11-12 23:59:04 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-11-12 23:59:04 +0000 |
| commit | 63961e6a1d35a467292bbabc8b9b33d28bba67dc (patch) | |
| tree | e14b5c4917f6fe339785108b357855e7f038c6d3 | |
| parent | 07a856853c56617e38859308c493062d86579102 (diff) | |
| download | emacs-63961e6a1d35a467292bbabc8b9b33d28bba67dc.tar.gz emacs-63961e6a1d35a467292bbabc8b9b33d28bba67dc.zip | |
(Emacs Invocation): Link to Emacs Server. Note that command-line-args
is processed during startup.
(Action Arguments): Correctly describe how file arguments interact with
the startup screen. Link to Lisp Interaction for scratch buffer.
(Initial Options): Link to Command Example for -batch option.
(Environment): Document initial-environment.
| -rw-r--r-- | doc/emacs/cmdargs.texi | 169 |
1 files changed, 91 insertions, 78 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 6be6a983461..2c5f3aabda4 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi | |||
| @@ -11,21 +11,19 @@ | |||
| 11 | @cindex startup (command line arguments) | 11 | @cindex startup (command line arguments) |
| 12 | @cindex invocation (command line arguments) | 12 | @cindex invocation (command line arguments) |
| 13 | 13 | ||
| 14 | GNU Emacs supports command line arguments to request various actions | 14 | Emacs supports command line arguments to request various actions |
| 15 | when invoking Emacs. These are for compatibility with other editors and | 15 | when invoking Emacs. These are for compatibility with other editors |
| 16 | for sophisticated activities. We don't recommend using them for | 16 | and for sophisticated activities. We don't recommend using them for |
| 17 | ordinary editing. | 17 | ordinary editing (@xref{Emacs Server}, for a way to access an existing |
| 18 | Emacs job from the command line). | ||
| 18 | 19 | ||
| 19 | Arguments starting with @samp{-} are @dfn{options}, and so is | 20 | Arguments starting with @samp{-} are @dfn{options}, and so is |
| 20 | @samp{+@var{linenum}}. All other arguments specify files to visit. | 21 | @samp{+@var{linenum}}. All other arguments specify files to visit. |
| 21 | Emacs visits the specified files while it starts up. The last file | 22 | 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 | specified on the command line becomes the current buffer; the other |
| 23 | are also visited in other buffers. If there are two files, they are | 24 | files are also visited in other buffers. As with most programs, the |
| 24 | both displayed; otherwise the last file is displayed along with a | 25 | special argument @samp{--} says that all subsequent arguments are file |
| 25 | buffer list that shows what other buffers there are. As with most | 26 | names, not options, even if they start with @samp{-}. |
| 26 | programs, the special argument @samp{--} says that all subsequent | ||
| 27 | arguments are file names, not options, even if they start with | ||
| 28 | @samp{-}. | ||
| 29 | 27 | ||
| 30 | Emacs command options can specify many things, such as the size and | 28 | 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 | 29 | position of the X window Emacs uses, its colors, and so on. A few |
| @@ -52,14 +50,15 @@ and the tables below always show an equal sign. | |||
| 52 | @vindex command-line-args | 50 | @vindex command-line-args |
| 53 | Most options specify how to initialize Emacs, or set parameters for | 51 | Most options specify how to initialize Emacs, or set parameters for |
| 54 | the Emacs session. We call them @dfn{initial options}. A few options | 52 | the Emacs session. We call them @dfn{initial options}. A few options |
| 55 | specify things to do: for example, load libraries, call functions, or | 53 | specify things to do, such as loading libraries or calling Lisp |
| 56 | terminate Emacs. These are called @dfn{action options}. These and file | 54 | functions. These are called @dfn{action options}. These and file |
| 57 | names together are called @dfn{action arguments}. Emacs processes all | 55 | names together are called @dfn{action arguments}. The action |
| 58 | the action arguments in the order they are written. The @file{.emacs} file | 56 | arguments are stored as a list of strings in the variable |
| 59 | can access the values of the action arguments as the elements of a list in | 57 | @code{command-line-args}. (Actually, when Emacs starts up, |
| 60 | the variable @code{command-line-args}. | 58 | @code{command-line-args} contains all the arguments passed from the |
| 61 | 59 | command line; during initialization, the initial arguments are removed | |
| 62 | 60 | from this list when they are processed, leaving only the action | |
| 61 | arguments.) | ||
| 63 | 62 | ||
| 64 | @menu | 63 | @menu |
| 65 | * Action Arguments:: Arguments to visit files, load libraries, | 64 | * Action Arguments:: Arguments to visit files, load libraries, |
| @@ -81,7 +80,7 @@ the variable @code{command-line-args}. | |||
| 81 | @node Action Arguments | 80 | @node Action Arguments |
| 82 | @appendixsec Action Arguments | 81 | @appendixsec Action Arguments |
| 83 | 82 | ||
| 84 | Here is a table of the action arguments and options: | 83 | Here is a table of action arguments: |
| 85 | 84 | ||
| 86 | @table @samp | 85 | @table @samp |
| 87 | @item @var{file} | 86 | @item @var{file} |
| @@ -94,9 +93,21 @@ the variable @code{command-line-args}. | |||
| 94 | @cindex visiting files, command-line argument | 93 | @cindex visiting files, command-line argument |
| 95 | @vindex inhibit-startup-buffer-menu | 94 | @vindex inhibit-startup-buffer-menu |
| 96 | Visit @var{file} using @code{find-file}. @xref{Visiting}. | 95 | Visit @var{file} using @code{find-file}. @xref{Visiting}. |
| 97 | If you visit several files at startup in this way, Emacs | 96 | |
| 98 | also displays a Buffer Menu buffer to show you what files it | 97 | When Emacs starts up, it displays the startup buffer in one window, |
| 99 | has visited. You can inhibit that by setting @code{inhibit-startup-buffer-menu} to @code{t}. | 98 | and the buffer visiting @var{file} in another window |
| 99 | (@pxref{Windows}). If you supply more than one file argument, the | ||
| 100 | displayed file is the last one specified on the command line; the | ||
| 101 | other files are visited but their buffers are not shown. | ||
| 102 | |||
| 103 | If the startup buffer is disabled (@pxref{Entering Emacs}), then | ||
| 104 | @var{file} is visited in a single window if one file argument was | ||
| 105 | supplied; with two file arguments, Emacs displays the files in two | ||
| 106 | different windows; with more than two file argument, Emacs displays | ||
| 107 | the last file specified in one window, plus a Buffer Menu in a | ||
| 108 | different window (@pxref{Several Buffers}). To inhibit using the | ||
| 109 | Buffer Menu for this, change the variable | ||
| 110 | @code{inhibit-startup-buffer-menu} to @code{t}. | ||
| 100 | 111 | ||
| 101 | @item +@var{linenum} @var{file} | 112 | @item +@var{linenum} @var{file} |
| 102 | @opindex +@var{linenum} | 113 | @opindex +@var{linenum} |
| @@ -107,7 +118,6 @@ Visit @var{file} using @code{find-file}, then go to line number | |||
| 107 | Visit @var{file} using @code{find-file}, then go to line number | 118 | Visit @var{file} using @code{find-file}, then go to line number |
| 108 | @var{linenum} and put point at column number @var{columnnum}. | 119 | @var{linenum} and put point at column number @var{columnnum}. |
| 109 | 120 | ||
| 110 | @need 3000 | ||
| 111 | @item -l @var{file} | 121 | @item -l @var{file} |
| 112 | @opindex -l | 122 | @opindex -l |
| 113 | @itemx --load=@var{file} | 123 | @itemx --load=@var{file} |
| @@ -149,8 +159,9 @@ Evaluate Lisp expression @var{expression}. | |||
| 149 | @item --insert=@var{file} | 159 | @item --insert=@var{file} |
| 150 | @opindex --insert | 160 | @opindex --insert |
| 151 | @cindex insert file contents, command-line argument | 161 | @cindex insert file contents, command-line argument |
| 152 | Insert the contents of @var{file} into the current buffer. This is like | 162 | Insert the contents of @var{file} into the @samp{*scratch*} buffer |
| 153 | what @kbd{M-x insert-file} does. @xref{Misc File Ops}. | 163 | (@pxref{Lisp Interaction}). This is like what @kbd{M-x insert-file} |
| 164 | does (@pxref{Misc File Ops}). | ||
| 154 | 165 | ||
| 155 | @item --kill | 166 | @item --kill |
| 156 | @opindex --kill | 167 | @opindex --kill |
| @@ -174,12 +185,12 @@ section describes the more general initial options; some other options | |||
| 174 | specifically related to the X Window System appear in the following | 185 | specifically related to the X Window System appear in the following |
| 175 | sections. | 186 | sections. |
| 176 | 187 | ||
| 177 | Some initial options affect the loading of init files. The normal | 188 | Some initial options affect the loading of the initialization file. |
| 178 | actions of Emacs are to first load @file{site-start.el} if it exists, | 189 | The normal actions of Emacs are to first load @file{site-start.el} if |
| 179 | then your own init file @file{~/.emacs} if it exists, and finally | 190 | it exists, then your own initialization file @file{~/.emacs} if it |
| 180 | @file{default.el} if it exists. @xref{Init File}. Certain options | 191 | exists, and finally @file{default.el} if it exists. @xref{Init File}. |
| 181 | prevent loading of some of these files or substitute other files for | 192 | Certain options prevent loading of some of these files or substitute |
| 182 | them. | 193 | other files for them. |
| 183 | 194 | ||
| 184 | @table @samp | 195 | @table @samp |
| 185 | @item -t @var{device} | 196 | @item -t @var{device} |
| @@ -208,27 +219,30 @@ Don't communicate directly with the window system, disregarding the | |||
| 208 | Emacs uses the terminal from which it was launched for all its display | 219 | Emacs uses the terminal from which it was launched for all its display |
| 209 | and input. | 220 | and input. |
| 210 | 221 | ||
| 211 | @need 3000 | ||
| 212 | @cindex batch mode | 222 | @cindex batch mode |
| 213 | @item -batch | 223 | @item -batch |
| 214 | @opindex --batch | 224 | @opindex --batch |
| 215 | @itemx --batch | 225 | @itemx --batch |
| 216 | Run Emacs in @dfn{batch mode}. Batch mode is used for running | 226 | Run Emacs in @dfn{batch mode}. Batch mode is used for running |
| 217 | programs written in Emacs Lisp from shell scripts, makefiles, and so | 227 | programs written in Emacs Lisp from shell scripts, makefiles, and so |
| 218 | on. You should also use the @samp{-l}, @samp{-f} or @samp{--eval} | 228 | on. To invoke a Lisp program, use the @samp{-batch} option in |
| 219 | option, to invoke a Lisp program to do batch processing. | 229 | conjunction with one or more of @samp{-l}, @samp{-f} or @samp{--eval} |
| 230 | (@pxref{Action Arguments}). @xref{Command Example}, for an example. | ||
| 220 | 231 | ||
| 221 | In batch mode, Emacs does not display the text being edited, and the | 232 | In batch mode, Emacs does not display the text being edited, and the |
| 222 | standard terminal interrupt characters such as @kbd{C-z} and @kbd{C-c} | 233 | standard terminal interrupt characters such as @kbd{C-z} and @kbd{C-c} |
| 223 | continue to have their normal effect. The functions @code{prin1}, | 234 | have their usual effect. Emacs functions that normally print a |
| 224 | @code{princ} and @code{print} output to @code{stdout} instead of the | 235 | message in the echo area will print to either the standard output |
| 225 | echo area, while @code{message} and error messages output to | 236 | stream (@code{stdout}) or the standard error stream (@code{stderr}) |
| 226 | @code{stderr}. Functions that would normally read from the minibuffer | 237 | instead. (To be precise, functions like @code{prin1}, @code{princ} |
| 227 | take their input from @code{stdin} instead. | 238 | and @code{print} print to @code{stdout}, while @code{message} and |
| 228 | 239 | @code{error} print to @code{stderr}.) Functions that normally read | |
| 229 | @samp{--batch} implies @samp{-q} (do not load an init file), but | 240 | keyboard input from the minibuffer take their input from the |
| 230 | @file{site-start.el} is loaded nonetheless. It also causes Emacs to | 241 | terminal's standard input stream (@code{stdin}) instead. |
| 231 | exit after processing all the command options. In addition, it | 242 | |
| 243 | @samp{--batch} implies @samp{-q} (do not load an initialization file), | ||
| 244 | but @file{site-start.el} is loaded nonetheless. It also causes Emacs | ||
| 245 | to exit after processing all the command options. In addition, it | ||
| 232 | disables auto-saving except in buffers for which it has been | 246 | disables auto-saving except in buffers for which it has been |
| 233 | explicitly requested. | 247 | explicitly requested. |
| 234 | 248 | ||
| @@ -257,11 +271,11 @@ comment delimiter. | |||
| 257 | @cindex bypassing init and @file{default.el} file | 271 | @cindex bypassing init and @file{default.el} file |
| 258 | @cindex init file, not loading | 272 | @cindex init file, not loading |
| 259 | @cindex @file{default.el} file, not loading | 273 | @cindex @file{default.el} file, not loading |
| 260 | Do not load your Emacs init file @file{~/.emacs}, or @file{default.el} | 274 | Do not load your Emacs initialization file, and do not load the file |
| 261 | either. Regardless of this switch, @file{site-start.el} is still loaded. | 275 | @file{default.el} either (@pxref{Init File}). Regardless of this |
| 262 | When invoked like this, Emacs does not allow saving options | 276 | switch, @file{site-start.el} is still loaded. When Emacs is invoked |
| 263 | changed with the @kbd{M-x customize} command and its variants. | 277 | like this, the Customize facility does not allow options to be saved |
| 264 | @xref{Easy Customization}. | 278 | (@pxref{Easy Customization}). |
| 265 | 279 | ||
| 266 | @item --no-site-file | 280 | @item --no-site-file |
| 267 | @opindex --no-site-file | 281 | @opindex --no-site-file |
| @@ -270,37 +284,35 @@ Do not load @file{site-start.el}. The options @samp{-q}, @samp{-u} | |||
| 270 | and @samp{--batch} have no effect on the loading of this file---this | 284 | and @samp{--batch} have no effect on the loading of this file---this |
| 271 | option and @samp{-Q} are the only options that block it. | 285 | option and @samp{-Q} are the only options that block it. |
| 272 | 286 | ||
| 287 | @item --no-splash | ||
| 288 | @opindex --no-splash | ||
| 289 | @vindex inhibit-startup-screen | ||
| 290 | @cindex splash screen | ||
| 291 | @cindex startup message | ||
| 292 | Do not display a startup screen. You can also achieve this effect by | ||
| 293 | setting the variable @code{inhibit-startup-screen} to non-@code{nil} | ||
| 294 | in your initialization file (@pxref{Entering Emacs}). | ||
| 295 | |||
| 273 | @item -Q | 296 | @item -Q |
| 274 | @opindex -Q | 297 | @opindex -Q |
| 275 | @itemx --quick | 298 | @itemx --quick |
| 276 | @opindex --quick | 299 | @opindex --quick |
| 277 | Start emacs with minimum customizations. This is like using @samp{-q} | 300 | Start emacs with minimum customizations. This is like using |
| 278 | and @samp{--no-site-file}, but also disables the startup screen. | 301 | @samp{-q}, @samp{--no-site-file}, and @samp{--no-splash} together. |
| 279 | 302 | ||
| 280 | @item -daemon | 303 | @item -daemon |
| 281 | @opindex -daemon | 304 | @opindex -daemon |
| 282 | @itemx --daemon | 305 | @itemx --daemon |
| 283 | @opindex --daemon | 306 | @opindex --daemon |
| 284 | Start emacs in background as a daemon (i.e. it will disconnect from the | 307 | Start Emacs as a daemon---after Emacs starts up, it starts the Emacs |
| 285 | terminal), do not open any frames and start the server. Clients can | 308 | server and disconnects from the terminal without opening any frames. |
| 286 | connect and create graphical or terminal frames using | 309 | You can then use the @command{emacsclient} command to connect to Emacs |
| 287 | @code{emacsclient}. | 310 | for editing. @xref{Emacs Server}, for information about using Emacs |
| 311 | as a daemon. | ||
| 288 | 312 | ||
| 289 | @item -daemon=@var{SERVER-NAME} | 313 | @item -daemon=@var{SERVER-NAME} |
| 290 | Start emacs in background as a daemon, and start the server with the | 314 | Start emacs in background as a daemon, and use @var{SERVER-NAME} as |
| 291 | name set to @var{SERVER-NAME}. | 315 | the server name. |
| 292 | |||
| 293 | @item --no-splash | ||
| 294 | @opindex --no-splash | ||
| 295 | @vindex inhibit-startup-screen | ||
| 296 | @cindex splash screen | ||
| 297 | @cindex startup message | ||
| 298 | Do not display a splash screen on startup. You can also achieve this | ||
| 299 | effect by setting the variable @code{inhibit-startup-screen} to | ||
| 300 | non-@code{nil} in you personal init file (but @emph{not} in | ||
| 301 | @file{site-start.el}). (This variable was called | ||
| 302 | @code{inhibit-splash-screen} or @code{inhibit-startup-message} in | ||
| 303 | previous Emacs versions.) | ||
| 304 | 316 | ||
| 305 | @item --no-desktop | 317 | @item --no-desktop |
| 306 | @opindex --no-desktop | 318 | @opindex --no-desktop |
| @@ -311,9 +323,8 @@ Do not reload any saved desktop. @xref{Saving Emacs Sessions}. | |||
| 311 | @itemx --user=@var{user} | 323 | @itemx --user=@var{user} |
| 312 | @opindex --user | 324 | @opindex --user |
| 313 | @cindex load init file of another user | 325 | @cindex load init file of another user |
| 314 | Load @var{user}'s Emacs init file @file{~@var{user}/.emacs} instead of | 326 | Load @var{user}'s initialization file instead of your |
| 315 | your own@footnote{ | 327 | own@footnote{This option has no effect on MS-Windows.}. |
| 316 | This option has no effect on MS-Windows.}. | ||
| 317 | 328 | ||
| 318 | @item --debug-init | 329 | @item --debug-init |
| 319 | @opindex --debug-init | 330 | @opindex --debug-init |
| @@ -422,10 +433,13 @@ software) inherit the environment from Emacs, too. | |||
| 422 | 433 | ||
| 423 | @findex setenv | 434 | @findex setenv |
| 424 | @findex getenv | 435 | @findex getenv |
| 436 | @vindex initial-environment | ||
| 425 | Inside Emacs, the command @kbd{M-x getenv} gets the value of an | 437 | Inside Emacs, the command @kbd{M-x getenv} gets the value of an |
| 426 | environment variable. @kbd{M-x setenv} sets a variable in the Emacs | 438 | environment variable. @kbd{M-x setenv} sets a variable in the Emacs |
| 427 | environment. (Environment variable substitutions with @samp{$} work | 439 | environment. (Environment variable substitutions with @samp{$} work |
| 428 | in the value just as in file names; see @ref{File Names with $}.) | 440 | in the value just as in file names; see @ref{File Names with $}.) The |
| 441 | variable @code{initial-environment} stores the initial environment | ||
| 442 | inherited by Emacs. | ||
| 429 | 443 | ||
| 430 | The way to set environment variables outside of Emacs depends on the | 444 | The way to set environment variables outside of Emacs depends on the |
| 431 | operating system, and especially the shell that you are using. For | 445 | operating system, and especially the shell that you are using. For |
| @@ -456,11 +470,10 @@ documentation for more information. | |||
| 456 | @node General Variables | 470 | @node General Variables |
| 457 | @appendixsubsec General Variables | 471 | @appendixsubsec General Variables |
| 458 | 472 | ||
| 459 | Here is an alphabetical list of specific environment variables that | 473 | Here is an alphabetical list of environment variables that have |
| 460 | have special meanings in Emacs, giving the name of each variable and | 474 | special meanings in Emacs. Most of these variables are also used by |
| 461 | its meaning. Most of these variables are also used by some other | 475 | some other programs. Emacs does not require any of these environment |
| 462 | programs. Emacs does not require any of these environment variables | 476 | variables to be set, but it uses their values if they are set. |
| 463 | to be set, but it uses their values if they are set. | ||
| 464 | 477 | ||
| 465 | @table @env | 478 | @table @env |
| 466 | @item CDPATH | 479 | @item CDPATH |