diff options
| author | Eli Zaretskii | 2016-01-06 20:25:45 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-01-06 20:25:45 +0200 |
| commit | c63246628461f748d66a8a07ba008de2e00fd33a (patch) | |
| tree | 6a58d3db5f15daf1c9566cb91c4c2a897051a3d2 /doc | |
| parent | 2f32cb547feb0864eae9345b50a1119decca28c0 (diff) | |
| download | emacs-c63246628461f748d66a8a07ba008de2e00fd33a.tar.gz emacs-c63246628461f748d66a8a07ba008de2e00fd33a.zip | |
Obey coding-system-for-write when writing stdout/stderr in batch
* src/print.c (printchar_to_stream):
* src/xdisp.c (message_to_stderr): If coding-system-for-write has
a non-nil value, use it to encode output in preference to
locale-coding-system. See the discussions in
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00048.html
for the details.
* doc/lispref/os.texi (Terminal Output): Document how to send
non-ASCII text via 'send-string-to-terminal'.
(Batch Mode): Document how text written to standard streams is
encoded. Fix inaccuracy regarding which output streams are used
by output functions in batch mode.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/os.texi | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 969c1d6e1ea..7206cd4ef86 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -2085,6 +2085,8 @@ than optimal. To fix the problem, set @code{baud-rate}. | |||
| 2085 | @defun send-string-to-terminal string &optional terminal | 2085 | @defun send-string-to-terminal string &optional terminal |
| 2086 | This function sends @var{string} to @var{terminal} without alteration. | 2086 | This function sends @var{string} to @var{terminal} without alteration. |
| 2087 | Control characters in @var{string} have terminal-dependent effects. | 2087 | Control characters in @var{string} have terminal-dependent effects. |
| 2088 | (If you need to display non-ASCII text on the terminal, encode it | ||
| 2089 | using one of the functions described in @ref{Explicit Encoding}.) | ||
| 2088 | This function operates only on text terminals. @var{terminal} may be | 2090 | This function operates only on text terminals. @var{terminal} may be |
| 2089 | a terminal object, a frame, or @code{nil} for the selected frame's | 2091 | a terminal object, a frame, or @code{nil} for the selected frame's |
| 2090 | terminal. In batch mode, @var{string} is sent to @code{stdout} when | 2092 | terminal. In batch mode, @var{string} is sent to @code{stdout} when |
| @@ -2252,13 +2254,21 @@ loads the library named @var{file}, or @samp{-f @var{function}}, which | |||
| 2252 | calls @var{function} with no arguments, or @samp{--eval @var{form}}. | 2254 | calls @var{function} with no arguments, or @samp{--eval @var{form}}. |
| 2253 | 2255 | ||
| 2254 | Any Lisp program output that would normally go to the echo area, | 2256 | Any Lisp program output that would normally go to the echo area, |
| 2255 | either using @code{message}, or using @code{prin1}, etc., with @code{t} | 2257 | either using @code{message}, or using @code{prin1}, etc., with |
| 2256 | as the stream, goes instead to Emacs's standard error descriptor when | 2258 | @code{t} as the stream, goes instead to Emacs's standard descriptors |
| 2257 | in batch mode. Similarly, input that would normally come from the | 2259 | when in batch mode: @code{message} writes to the standard error |
| 2258 | minibuffer is read from the standard input descriptor. | 2260 | descriptor, while @code{prin1} and other print functions write to the |
| 2259 | Thus, Emacs behaves much like a noninteractive | 2261 | standard output. Similarly, input that would normally come from the |
| 2260 | application program. (The echo area output that Emacs itself normally | 2262 | minibuffer is read from the standard input descriptor. Thus, Emacs |
| 2261 | generates, such as command echoing, is suppressed entirely.) | 2263 | behaves much like a noninteractive application program. (The echo |
| 2264 | area output that Emacs itself normally generates, such as command | ||
| 2265 | echoing, is suppressed entirely.) | ||
| 2266 | |||
| 2267 | Non-ASCII text written to the standard output or error descriptors is | ||
| 2268 | by default encoded using @code{locale-coding-system} (@pxref{Locales}) | ||
| 2269 | if it is non-@code{nil}; this can be overridden by binding | ||
| 2270 | @code{coding-system-for-write} to a coding system of you choice | ||
| 2271 | (@pxref{Explicit Encoding}). | ||
| 2262 | 2272 | ||
| 2263 | @defvar noninteractive | 2273 | @defvar noninteractive |
| 2264 | This variable is non-@code{nil} when Emacs is running in batch mode. | 2274 | This variable is non-@code{nil} when Emacs is running in batch mode. |