aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-07-22 15:18:32 +0000
committerRichard M. Stallman2003-07-22 15:18:32 +0000
commit582ef186ea8ed5d6a6718f09bff92e6a756c7f9d (patch)
treeaad387c149bb39a2b5268dd5ab343af357ebeca5
parent75442b3f4306851019cbe7f9bdf8a52669433e97 (diff)
downloademacs-582ef186ea8ed5d6a6718f09bff92e6a756c7f9d.tar.gz
emacs-582ef186ea8ed5d6a6718f09bff92e6a756c7f9d.zip
(Decoding Output): New node.
-rw-r--r--lispref/processes.texi75
1 files changed, 53 insertions, 22 deletions
diff --git a/lispref/processes.texi b/lispref/processes.texi
index 159ed47c059..39feaa68a4c 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -898,29 +898,11 @@ you want to keep the output to those streams separate, you should
898redirect one of them to a file--for example, by using an appropriate 898redirect one of them to a file--for example, by using an appropriate
899shell command. 899shell command.
900 900
901 Subprocess output is normally decoded using a coding system before the
902buffer or filter function receives it, much like text read from a file.
903You can use @code{set-process-coding-system} to specify which coding
904system to use (@pxref{Process Information}). Otherwise, the coding
905system comes from @code{coding-system-for-read}, if that is
906non-@code{nil}; or else from the defaulting mechanism (@pxref{Default
907Coding Systems}).
908
909 @strong{Warning:} Coding systems such as @code{undecided} which
910determine the coding system from the data do not work entirely reliably
911with asynchronous subprocess output. This is because Emacs has to
912process asynchronous subprocess output in batches, as it arrives. Emacs
913must try to detect the proper coding system from one batch at a time,
914and this does not always work. Therefore, if at all possible, use a
915coding system which determines both the character code conversion and
916the end of line conversion---that is, one like @code{latin-1-unix},
917rather than @code{undecided} or @code{latin-1}.
918
919@menu 901@menu
920* Process Buffers:: If no filter, output is put in a buffer. 902* Process Buffers:: If no filter, output is put in a buffer.
921* Filter Functions:: Filter functions accept output from the process. 903* Filter Functions:: Filter functions accept output from the process.
922* Accepting Output:: Explicitly permitting subprocess output. 904* Decoding Ouptut:: Filters can get unibyte or multibyte strings.
923 Waiting for subprocess output. 905* Accepting Output:: How to wait until process output arrives.
924@end menu 906@end menu
925 907
926@node Process Buffers 908@node Process Buffers
@@ -1162,6 +1144,55 @@ there is no filter function:
1162@end smallexample 1144@end smallexample
1163@end ignore 1145@end ignore
1164 1146
1147@node Decoding Output
1148@subsection Decoding Process Output
1149
1150 When Emacs writes process output directly into a multibyte buffer,
1151it decodes the output according to the process output coding system.
1152If the coding system is @code{raw-text} or @code{no-conversion}, Emacs
1153converts the unibyte output to multibyte using
1154@code{string-to-multibyte}, inserts the resulting multibyte text.
1155
1156 You can use @code{set-process-coding-system} to specify which coding
1157system to use (@pxref{Process Information}). Otherwise, the coding
1158system comes from @code{coding-system-for-read}, if that is
1159non-@code{nil}; or else from the defaulting mechanism (@pxref{Default
1160Coding Systems}).
1161
1162 @strong{Warning:} Coding systems such as @code{undecided} which
1163determine the coding system from the data do not work entirely
1164reliably with asynchronous subprocess output. This is because Emacs
1165has to process asynchronous subprocess output in batches, as it
1166arrives. Emacs must try to detect the proper coding system from one
1167batch at a time, and this does not always work. Therefore, if at all
1168possible, specify a coding system that determines both the character
1169code conversion and the end of line conversion---that is, one like
1170@code{latin-1-unix}, rather than @code{undecided} or @code{latin-1}.
1171
1172@cindex filter multibyte flag, of process
1173@cindex process filter multibyte flag
1174 When Emacs calls a process filter function, it provides the process
1175output as a multibyte string or as a unibyte string according to the
1176process's filter multibyte flag. If the flag is non-@code{nil}, Emacs
1177decodes the output according to the process output coding system to
1178produce a multibyte string, and passes that to the process. If the
1179flag is @code{nil}, Emacs puts the output into a unibyte string, with
1180no decoding, and passes that.
1181
1182 When you create a process, the filter multibyte flag takes its
1183initial value from @code{default-enable-multibyte-characters}. If you
1184want to change the flag later on, use
1185@code{set-process-filter-multibyte}.
1186
1187@defun set-process-filter-multibyte process multibyte
1188This function sets the filter multibyte flag of @var{process}
1189to @var{multibyte}.
1190@end defun
1191
1192@defun process-filter-multibyte-p process
1193This function returns the filter multibyte flag of @var{process}.
1194@end defun
1195
1165@node Accepting Output 1196@node Accepting Output
1166@subsection Accepting Output from Processes 1197@subsection Accepting Output from Processes
1167 1198