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. Normally, Emacs first loads site-start.el if it exists, then your own initialization file if it exists, and finally the default initialization file default.el if it exists (Init File). Certain options prevent loading of some of these files or substitute other files for them.
- -chdir directory, –chdir=/directory/
- @opindex -chdir @opindex –chdir Change to directory before doing anything else. This is mainly used by session management in X so that Emacs starts in the same directory as it stopped. This makes desktop saving and restoring easier.
- -t device, –terminal=/device/
- @opindex -t @opindex –terminal Use device as the device for terminal input and output. This option implies
--no-window-system. - -d display, –display=/display/
- @opindex -d @opindex –display Use the X Window System and use the display named display to open the initial Emacs frame. Display X, for more details.
- -nw, –no-window-system
- @opindex -nw @opindex –no-window-system Don't communicate directly with the window system, disregarding the
DISPLAYenvironment 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
- @opindex –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
-batchoption in conjunction with one or more of-l,-for--eval(Action Arguments). Command Example, for an example. In batch mode, Emacs does not display the text being edited, and the standard terminal interrupt characters such asC-zandC-chave 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 likeprin1,princandprintprint tostdout, whilemessageanderrorprint tostderr.) Functions that normally read keyboard input from the minibuffer take their input from the terminal's standard input stream (stdin) instead.--batchimplies-q(do not load an initialization file), butsite-start.elis 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 auto-saving is explicitly requested, and when saving files it omits thefsyncsystem call unless otherwise requested. Errors that occur when running a--batchEmacs will result in an Emacs Lisp backtrace being printed. To disable this behavior, setbacktrace-on-error-noninteractivetonil. - –script file
- @opindex –script 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 @example #!/usr/bin/emacs –script @end example which will invoke Emacs with--scriptand supply the name of the script file as file. Emacs Lisp then treats the#!on this first line as a comment delimiter. - -x
- @opindex -x This option can only be used in executable script files, and should be invoked like this: @example #!/usr/bin/emacs -x @end example This is like
--script, but suppresses loading the init files (like--quick), and can't be used on a normal command line (since it doesn't specify the script to load). In addition, when it reaches the end of the script, it exits Emacs and uses the value of the final form as the exit value from the script (if the final value is numerical). Otherwise, it will always exit with a zero value. Note that when Emacs reads the Lisp code in this case, it ignores any file-local variables (Specifying File Variables), both in the first line and in a local-variables section near the end of the file. - –no-build-details
- @opindex –no-build-details Omit details like system name and build time from the Emacs executable, so that builds are more deterministic. This switch is not meant for regular (or interactive) use, since it makes commands like
system-namereturnnil. - -q, –no-init-file
- @opindex -q @opindex –no-init-file Do not load any initialization file (Init File). When Emacs is invoked with this option, the Customize facility does not allow options to be saved (Easy Customization). This option does not disable loading
site-start.el. - –no-site-file, -nsl
- @opindex –no-site-file @opindex -nsl Do not load
site-start.el(Init File). The-Qoption does this too, but other options like-qdo not. - –no-site-lisp
- @opindex –no-site-lisp Do not include the
site-lispdirectories inload-path(Init File). The-Qoption does this too. - –init-directory
- @opindex –init-directory Specify the directory to use when looking for the Emacs init files. Note that this merely overrides the value of
user-emacs-directory, the directory which Emacs usually determines as side effect of searching for your init file (Find Init), but does not change the search for the~/.emacsinit file. In particular, if there's noinit.elfile in the directory named by this option, Emacs will find and useinit.elit would have used without this option (but will search for your other per-user Emacs files in the directory specified by this option). If you want to force Emacs to useinit.elfile in this directory, make sure it exists there before starting Emacs with this option. - –no-splash
- @opindex –no-splash Do not display a startup screen. You can also achieve this effect by setting the variable
inhibit-startup-screento non-nilin your initialization file (Entering Emacs). - –no-x-resources
- @opindex –no-x-resources Do not load X resources. You can also achieve this effect by setting the variable
inhibit-x-resourcestotin your initialization file (Resources). - -Q, –quick
- @opindex -Q @opindex –quick Start Emacs with minimum customizations. This is similar to using
-q,--no-site-file,--no-site-lisp,--no-x-resources, and--no-splashtogether. - -daemon, –daemon[=/name/], –bg-daemon[=/name/], –fg-daemon[=/name/]
- @opindex -daemon @opindex –daemon Start Emacs as a daemon: after Emacs starts up, it starts the Emacs server without opening any frames. You can then use the
emacsclientcommand to connect to Emacs for editing. (Optionally, you can specify an explicit name for the server; if you do, you will need to specify the same name when you invokeemacsclient, via its--socket-nameoption, see emacsclient Options.) Emacs Server, for information about using Emacs as a daemon. A ``background'' daemon disconnects from the terminal and runs in the background (--daemonis an alias for--bg-daemon). - –no-desktop
- @opindex –no-desktop Do not reload any saved desktop. Saving Emacs Sessions.
- -u user, –user=/user/
- @opindex -u @opindex –user Load user's initialization file instead of your own(This option has no effect on MS-Windows.).
- –debug-init
- @opindex –debug-init Enable the Emacs Lisp debugger for errors in the init file. Entering the Debugger on an Error.
- –module-assertions
- @opindex –module-assertions Enable expensive correctness checks when dealing with dynamically loadable modules. This is intended for module authors that wish to verify that their module conforms to the module API requirements. The option makes Emacs abort if a module-related assertion triggers. Writing Dynamically-Loaded Modules.
- –dump-file=/file/
- @opindex –dump-file Load the dumped Emacs state from the named file. By default, an installed Emacs will look for its dump state in a file named
/emacs/.pdmpin the directory where the Emacs installation puts the architecture-dependent files; the variableexec-directoryholds the name of that directory. emacs is the name of the Emacs executable file, normally justemacs. (When you invoke Emacs from thesrcdirectory where it was built without installing it, it will look for the dump file in the directory of the executable.) If you rename or move the dump file to a different place, you can use this option to tell Emacs where to find that file.