SXEmacs supports command line arguments you can use to request various actions when invoking SXEmacs. The commands are for compatibility with other editors and for sophisticated activities. If you are using SXEmacs under the X window system, you can also use a number of standard Xt command line arguments. Command line arguments are not usually needed for editing with SXEmacs; new users can skip this section.
Many editors are designed to be started afresh each time you want to edit. You start the editor to edit one file; then exit the editor. The next time you want to edit either another file or the same one, you start the editor again. Under these circumstances, it makes sense to use a command line argument to say which file to edit.
The recommended way to use SXEmacs is to start it only once, just after you log in, and do all your editing in the same SXEmacs process. Each time you want to edit a file, you visit it using the existing SXEmacs. SXEmacs creates a new buffer for each file, and (unless you kill some of the buffers) SXEmacs eventually has many files in it ready for editing. Usually you do not kill the SXEmacs process until you are about to log out. Since you usually read files by typing commands to SXEmacs, command line arguments for specifying a file when SXEmacs is started are seldom needed.
SXEmacs accepts command-line arguments that specify files to visit, functions to call, and other activities and operating modes. If you are running SXEmacs under the X window system, a number of standard Xt command line arguments are available, as well as a few X parameters that are SXEmacs-specific.
Options with long names with a single initial hyphen are also recognized with the GNU double initial hyphen syntax. (The reverse is not true.)
The following subsections list:
Command line arguments are processed in the order they appear on the command line; however, certain arguments (the ones in the second table) must be at the front of the list if they are used.
Here are the arguments allowed:
Visit file using
find-file. See Visiting.
Visit file using
find-file, then go to line number
linenum in it.
Load a file file of Lisp code with the function
See Lisp Libraries.
Call Lisp function function with no arguments.
Interpret the next argument as a Lisp expression, and evaluate it. You must be very careful of the shell quoting here.
Insert the contents of file into the current buffer. This is like what M-x insert-buffer does; See Misc File Ops.
Exit from SXEmacs without asking for confirmation. Always the last argument processed, no matter where it appears in the command line.
Prints version information. This implies ‘-batch’.
% sxemacs -version SXEmacs: v22.1.15-131-gccf396e, built Sun May 10 07:40:48 2015 on bastard.steveyoungs.com
Prints a summary of command-line options and then exits.
The following arguments are recognized only at the beginning of the command line. If more than one of them appears, they must appear in the order in which they appear in this table.
Print the ID for the new portable dumper’s dump file on the terminal and exit. (Prints an error message and exits if SXEmacs was not configured ‘--pdump’.)
Don’t load the dump file. Roughly equivalent to old temacs. (Ignored if SXEmacs was not configured ‘--pdump’.)
Use file instead of the terminal for input and output. This implies the ‘-nw’ option, documented below.
Run SXEmacs in batch mode, which means that the text being edited is
not displayed and the standard Unix interrupt characters such as
C-z and C-c continue to have their normal effect. SXEmacs in
batch mode outputs to
stderr only what would normally be printed
in the echo area under program control.
Batch mode is used for running programs written in SXEmacs Lisp from shell scripts, makefiles, and so on. Normally the ‘-l’ switch or ‘-f’ switch will be used as well, to invoke a Lisp program to do the batch processing.
‘-batch’ implies ‘-q’ (do not load an init file). It also causes SXEmacs to kill itself after all command switches have been processed. In addition, auto-saving is not done except in buffers for which it has been explicitly requested.
Start up SXEmacs in TTY mode (using the TTY SXEmacs was started from), rather than trying to connect to an X display. Note that this happens automatically if the ‘DISPLAY’ environment variable is not set.
Tells SXEmacs to assume that any TTY frame should be colorized even when the color support was not detected. The color support is of the 8 color ANSI terminals. If color capabilities of the terminal are detected those more accurate settings are used.
Enter the debugger if an error in the init file occurs.
Displays information on how SXEmacs constructs the various paths into its hierarchy on startup. (See also see Startup Paths.)
Do not map the initial frame. This is useful if you want to start up SXEmacs as a server (e.g. for gnuserv screens or external client widgets).
Do not load your SXEmacs init file. See Init File.
Do not load the site-specific init file lisp/site-start.el.
Do not load global symbol files (auto-autoloads) at startup. This implies ‘-vanilla’.
Do not process early packages. (For more information on startup issues concerning the package system, See Startup Paths.)
This is equivalent to ‘-q -no-site-file -no-early-packages’.
Load file as your SXEmacs init file instead of the default $XDG_CONFIG_HOME/sxemacs/init.el.
Use directory as the location of your initialization files.
Use directory as the location of your local,
early-packages, hierarchy instead of the
Attempt to load user init instead of your own. There is no privilege escalation going on, the SXEmacs process is still owned by you, not user. In fact, using this option is often hindered by file and directory permissions. YMMV. See Init File.
Note that the init file can get access to the command line argument
values as the elements of a list in the variable
command-line-args. (The arguments in the second table above will
already have been processed and will not be in the list.) The init file
can override the normal processing of the other arguments by setting
One way to use command switches is to visit many files automatically:
.c file as a separate argument to SXEmacs, so that
Emacs visits each file (see Visiting).
Here is an advanced example that assumes you have a Lisp program file called hack-c-program.el which, when loaded, performs some useful operation on the current buffer, expected to be a C program.
sxemacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
Here SXEmacs is told to visit foo.c, load hack-c-program.el
(which makes changes in the visited file), save foo.c (note that
save-buffer is the function that C-x C-s is bound to), and
then exit to the shell from which the command was executed. ‘-batch’
guarantees there will be no problem redirecting output to log,
because SXEmacs will not assume that it has a display terminal to work
If you are running SXEmacs under X, a number of options are available to control color, border, and window title and icon name:
Use title as the window title. This sets the
frame-title-format variable, which controls the title of the X
window corresponding to the selected frame. This is the same format as
Use title as the icon name. This sets the
frame-icon-title-format variable, which controls the title of
the icon corresponding to the selected frame.
Use color as the mouse color.
Use color as the text-cursor foreground color.
Install a private colormap for SXEmacs.
In addition, SXEmacs allows you to use a number of standard Xt command line arguments.
Use color as the background color.
Use color as the border color.
Use width as the border width.
When running under the X window system, create the window containing the Emacs frame on the display named display.
Use color as the foreground color.
Use name as the default font.
Use the geometry (window size and/or position) specified by spec.
Start up iconified.
Bring up SXEmacs in reverse video.
Use the resource manager resources specified by name.
The default is to use the name of the program (
the resource manager name.
Read something into the resource database for this invocation of SXEmacs only.