aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii2015-01-15 17:50:50 +0200
committerEli Zaretskii2015-01-15 17:50:50 +0200
commit0f238ea450b3a976f04c95c4cf8befaadad1cdd0 (patch)
treecd278a1441bd610bd91eb7fbd6f38aea7aa4bca8 /doc
parent3b7eed4ebb3c18799ec791d0c6bd53c019f48f73 (diff)
downloademacs-0f238ea450b3a976f04c95c4cf8befaadad1cdd0.tar.gz
emacs-0f238ea450b3a976f04c95c4cf8befaadad1cdd0.zip
Add set-binary-mode primitive to switch a standard stream to binary I/O.
src/fileio.c: Include binary-io.h. (Fset_binary_mode): New function. (syms_of_fileio): Defsubr it. (syms_of_fileio) <Qstdin, Qstdout, Qstderr>: DEFSYM them. admin/unidata/unidata/uvs.el (uvs-print-table-ivd): Call set-binary-mode on stdout. doc/lispref/streams.texi (Input Functions): Document 'set-binary-mode'. (Output Functions): Cross-reference to documentation of 'set-binary-mode'. etc/NEWS: Mention 'set-binary-mode'.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/streams.texi24
2 files changed, 30 insertions, 0 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 941be3cf582..4c0c116ba5a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12015-01-15 Eli Zaretskii <eliz@gnu.org>
2
3 * streams.texi (Input Functions): Document 'set-binary-mode'.
4 (Output Functions): Cross-reference to documentation of
5 'set-binary-mode'.
6
12015-01-04 Paul Eggert <eggert@cs.ucla.edu> 72015-01-04 Paul Eggert <eggert@cs.ucla.edu>
2 8
3 batch write-region no longer says "Wrote FOO" 9 batch write-region no longer says "Wrote FOO"
diff --git a/doc/lispref/streams.texi b/doc/lispref/streams.texi
index 5e4df009b73..e52a543110b 100644
--- a/doc/lispref/streams.texi
+++ b/doc/lispref/streams.texi
@@ -339,6 +339,25 @@ shared structures. @xref{Circular Objects}. Its default value is
339@code{t}. 339@code{t}.
340@end defvar 340@end defvar
341 341
342@cindex binary I/O in batch mode
343When reading or writing from the standard input/output streams of the
344Emacs process in batch mode, it is sometimes required to make sure any
345arbitrary binary data will be read/written verbatim, and/or that no
346translation of newlines to or from CR-LF pairs are performed. This
347issue does not exist on Posix hosts, only on MS-Windows and MS-DOS.
348The following function allows to control the I/O mode of any standard
349stream of the Emacs process.
350
351@defun set-binary-mode stream mode
352Switch @var{stream} into binary or text I/O mode. If @var{mode} is
353non-@code{nil}, switch to binary mode, otherwise switch to text mode.
354The value of @var{stream} can be one of @code{stdin}, @code{stdout},
355or @code{stderr}. This function flushes any pending output data of
356@var{stream} as a side effect, and returns the previous value of I/O
357mode for @var{stream}. On Posix hosts, it always returns a
358non-@code{nil} value and does nothing except flushing pending output.
359@end defun
360
342@node Output Streams 361@node Output Streams
343@section Output Streams 362@section Output Streams
344@cindex stream (for printing) 363@cindex stream (for printing)
@@ -686,6 +705,11 @@ This function outputs @var{object} to @var{stream}, just like
686indent and fill the object to make it more readable for humans. 705indent and fill the object to make it more readable for humans.
687@end defun 706@end defun
688 707
708If you need to use binary I/O in batch mode, e.g., use the functions
709described in this section to write out arbitrary binary data or avoid
710conversion of newlines on non-Posix hosts, see @ref{Input Functions,
711set-binary-mode}.
712
689@node Output Variables 713@node Output Variables
690@section Variables Affecting Output 714@section Variables Affecting Output
691@cindex output-controlling variables 715@cindex output-controlling variables