You can use command line arguments to request various actions when you start SXEmacs. Since you do not need to start SXEmacs more than once per day, and will often leave your SXEmacs session running longer than that, command line arguments are hardly ever used. As a practical matter, it is best to avoid making the habit of using them, since this habit would encourage you to kill and restart SXEmacs unnecessarily often. These options exist for two reasons: to be compatible with other editors (for invocation by other programs) and to enable shell scripts to run specific Lisp programs.
This section describes how SXEmacs processes command line arguments, and how you can customize them.
Note: Some other editors require you to start afresh each time you want to edit a file. With this kind of editor, you will probably specify the file as a command line argument.
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 different file, you visit it with the existing SXEmacs, which eventually comes to have many files in it ready for editing. Usually you do not kill the SXEmacs until you are about to log out.
This function parses the command line that SXEmacs was called with, processes it, loads the user's init.el file and displays the startup messages.
The value of this variable is
tonce the command line has been processed.If you redump SXEmacs by calling
dump-emacs, you may wish to set this variable tonilfirst in order to cause the new dumped SXEmacs to process its new command line arguments.
The value of this variable is an alist of user-defined command-line options and associated handler functions. This variable exists so you can add elements to it.
A command line option is an argument on the command line of the form:
-optionThe elements of the
command-switch-alistlook like this:(option . handler-function)The handler-function is called to handle option and receives the option name as its sole argument.
In some cases, the option is followed in the command line by an argument. In these cases, the handler-function can find all the remaining command-line arguments in the variable
command-line-args-left. The entire list of command-line arguments is incommand-line-args.The command line arguments are parsed by the
command-line-1function in the startup.el file. See also Command Line Switches and Arguments.
The value of this variable is the list of command line arguments passed to SXEmacs.
This variable's value is a list of functions for handling an unrecognized command-line argument. Each time the next argument to be processed has no special meaning, the functions in this list are called, in order of appearance, until one of them returns a non-
nilvalue.These functions are called with no arguments. They can access the command-line argument under consideration through the variable
argi. The remaining arguments (not including the current one) are in the variablecommand-line-args-left.When a function recognizes and processes the argument in
argi, it should return a non-nilvalue to say it has dealt with that argument. If it has also dealt with some of the following arguments, it can indicate that by deleting them fromcommand-line-args-left.If all of these functions return
nil, then the argument is used as a file name to visit.