ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial

C.2 Initial Options

The initial options specify parameters for the Emacs session. This section describes the more general initial options; some other options specifically related to the X Window System appear in the following sections.

Some initial options affect the loading of the initialization file. The normal actions of Emacs are to first load site-start.el if it exists, then your own initialization file ~/.emacs if it exists, and finally default.el if it exists. See Init File. Certain options prevent loading of some of these files or substitute other files for them.

-t device
--terminal=device
Use device as the device for terminal input and output. ‘--terminal’ implies ‘--no-window-system’.
-d display
--display=display
Use the X Window System and use the display named display to open the initial Emacs frame. See Display X, for more details.
-nw
--no-window-system
Don't communicate directly with the window system, disregarding the DISPLAY environment variable even if it is set. This means that Emacs uses the terminal from which it was launched for all its display and input.


-batch
--batch
Run Emacs in batch mode. Batch mode is used for running programs written in Emacs Lisp from shell scripts, makefiles, and so on. To invoke a Lisp program, use the ‘-batch’ option in conjunction with one or more of ‘-l’, ‘-f’ or ‘--eval’ (see Action Arguments). See Command Example, for an example.

In batch mode, Emacs does not display the text being edited, and the standard terminal interrupt characters such as C-z and C-c have their usual effect. Emacs functions that normally print a message in the echo area will print to either the standard output stream (stdout) or the standard error stream (stderr) instead. (To be precise, functions like prin1, princ and print print to stdout, while message and error print to stderr.) Functions that normally read keyboard input from the minibuffer take their input from the terminal's standard input stream (stdin) instead.

--batch’ implies ‘-q’ (do not load an initialization file), but site-start.el is loaded nonetheless. It also causes Emacs to exit after processing all the command options. In addition, it disables auto-saving except in buffers for which it has been explicitly requested.

--script file
Run Emacs in batch mode, like ‘--batch’, and then read and execute the Lisp code in file.

The normal use of this option is in executable script files that run Emacs. They can start with this text on the first line

          #!/usr/bin/emacs --script

which will invoke Emacs with ‘--script’ and supply the name of the script file as file. Emacs Lisp then treats ‘#!’ as a comment delimiter.

-q
--no-init-file
Do not load your Emacs initialization file, and do not load the file default.el either (see Init File). Regardless of this switch, site-start.el is still loaded. When Emacs is invoked like this, the Customize facility does not allow options to be saved (see Easy Customization).
--no-site-file
Do not load site-start.el. The options ‘-q’, ‘-u’ and ‘--batch’ have no effect on the loading of this file—this option and ‘-Q’ are the only options that block it.
--no-splash
Do not display a startup screen. You can also achieve this effect by setting the variable inhibit-startup-screen to non-nil in your initialization file (see Entering Emacs).
-Q
--quick
Start emacs with minimum customizations, similar to using ‘-q’, ‘--no-site-file’, and ‘--no-splash’ together. This also stops Emacs from processing X resources by setting inhibit-x-resources to t (see Resources).
-daemon
--daemon
Start Emacs as a daemon—after Emacs starts up, it starts the Emacs server and disconnects from the terminal without opening any frames. You can then use the emacsclient command to connect to Emacs for editing. See Emacs Server, for information about using Emacs as a daemon.
-daemon=SERVER-NAME
Start emacs in background as a daemon, and use SERVER-NAME as the server name.
--no-desktop
Do not reload any saved desktop. See Saving Emacs Sessions.
-u user
--user=user
Load user's initialization file instead of your own1.
--debug-init
Enable the Emacs Lisp debugger for errors in the init file. See Entering the Debugger on an Error.

Footnotes

[1] This option has no effect on MS-Windows.

blog comments powered by Disqus