diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/batch-mode.html | |
new repository
Diffstat (limited to 'devdocs/elisp/batch-mode.html')
| -rw-r--r-- | devdocs/elisp/batch-mode.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/batch-mode.html b/devdocs/elisp/batch-mode.html new file mode 100644 index 00000000..2a800961 --- /dev/null +++ b/devdocs/elisp/batch-mode.html @@ -0,0 +1,12 @@ + <h3 class="section">Batch Mode</h3> <p>The command-line option ‘<samp>-batch</samp>’ causes Emacs to run noninteractively. In this mode, Emacs does not read commands from the terminal, it does not alter the terminal modes, and it does not expect to be outputting to an erasable screen. The idea is that you specify Lisp programs to run; when they are finished, Emacs should exit. The way to specify the programs to run is with ‘<samp>-l <var>file</var></samp>’, which loads the library named <var>file</var>, or ‘<samp>-f <var>function</var></samp>’, which calls <var>function</var> with no arguments, or ‘<samp>--eval=<var>form</var></samp>’. </p> <p>Any Lisp program output that would normally go to the echo area, either using <code>message</code>, or using <code>prin1</code>, etc., with <code>t</code> as the stream (see <a href="output-streams">Output Streams</a>), goes instead to Emacs’s standard descriptors when in batch mode: <code>message</code> writes to the standard error descriptor, while <code>prin1</code> and other print functions write to the standard output. Similarly, input that would normally come from the minibuffer is read from the standard input descriptor. Thus, Emacs behaves much like a noninteractive application program. (The echo area output that Emacs itself normally generates, such as command echoing, is suppressed entirely.) </p> <p>Non-ASCII text written to the standard output or error descriptors is by default encoded using <code>locale-coding-system</code> (see <a href="locales">Locales</a>) if it is non-<code>nil</code>; this can be overridden by binding <code>coding-system-for-write</code> to a coding system of you choice (see <a href="explicit-encoding">Explicit Encoding</a>). </p> <dl> <dt id="noninteractive">Variable: <strong>noninteractive</strong> +</dt> <dd><p>This variable is non-<code>nil</code> when Emacs is running in batch mode. </p></dd> +</dl> <p>If Emacs exits due to signaling an error in batch mode, the exit status of the Emacs command is non-zero: </p> <div class="example"> <pre class="example">$ emacs -Q --batch --eval '(error "foo")'; echo $? +foo +255 +</pre> +</div><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Batch-Mode.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Batch-Mode.html</a> + </p> +</div> |
