aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-04-15 17:50:58 -0700
committerGlenn Morris2012-04-15 17:50:58 -0700
commit62f4b18cfdff92ba9cc335a35e7103f553abda0c (patch)
tree2c1f759f8b55fe7022d4fab0b35ef1774290cd8a
parent9a864fa27d1bdc85c3542d34e6a2fc02fe03c718 (diff)
downloademacs-62f4b18cfdff92ba9cc335a35e7103f553abda0c.tar.gz
emacs-62f4b18cfdff92ba9cc335a35e7103f553abda0c.zip
More small edits for doc/lispref/processes.texi
* doc/lispref/processes.texi (Process Information, Input to Processes) (Signals to Processes, Output from Processes, Process Buffers) (Filter Functions, Decoding Output): Copyedits.
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/processes.texi144
2 files changed, 68 insertions, 82 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 74c32ccb7bb..3335e8a5c0c 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12012-04-16 Glenn Morris <rgm@gnu.org>
2
3 * processes.texi (Process Information, Input to Processes)
4 (Signals to Processes, Output from Processes, Process Buffers)
5 (Filter Functions, Decoding Output): Copyedits.
6
12012-04-15 Glenn Morris <rgm@gnu.org> 72012-04-15 Glenn Morris <rgm@gnu.org>
2 8
3 * processes.texi (Processes, Subprocess Creation, Shell Arguments): 9 * processes.texi (Processes, Subprocess Creation, Shell Arguments):
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 509b3a1c2c6..94730a24df5 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -726,17 +726,17 @@ happen sooner or later).
726@section Process Information 726@section Process Information
727 727
728 Several functions return information about processes. 728 Several functions return information about processes.
729@code{list-processes} is provided for interactive use.
730 729
731@deffn Command list-processes &optional query-only 730@deffn Command list-processes &optional query-only buffer
732This command displays a listing of all living processes. In addition, 731This command displays a listing of all living processes. In addition,
733it finally deletes any process whose status was @samp{Exited} or 732it finally deletes any process whose status was @samp{Exited} or
734@samp{Signaled}. It returns @code{nil}. 733@samp{Signaled}. It returns @code{nil}.
735 734
736The processes are shown in a buffer named @file{*Process List*}, whose 735The processes are shown in a buffer named @file{*Process List*}
737major mode is named Process Menu mode. 736(unless you specify otherwise using the optional argument @var{buffer}),
737whose major mode is Process Menu mode.
738 738
739If @var{query-only} is non-@code{nil} then it lists only processes 739If @var{query-only} is non-@code{nil}, it only lists processes
740whose query flag is non-@code{nil}. @xref{Query Before Exit}. 740whose query flag is non-@code{nil}. @xref{Query Before Exit}.
741@end deffn 741@end deffn
742 742
@@ -752,8 +752,8 @@ This function returns a list of all processes that have not been deleted.
752@end defun 752@end defun
753 753
754@defun get-process name 754@defun get-process name
755This function returns the process named @var{name}, or @code{nil} if 755This function returns the process named @var{name} (a string), or
756there is none. An error is signaled if @var{name} is not a string. 756@code{nil} if there is none.
757 757
758@smallexample 758@smallexample
759@group 759@group
@@ -772,7 +772,7 @@ were given to the program.
772@smallexample 772@smallexample
773@group 773@group
774(process-command (get-process "shell")) 774(process-command (get-process "shell"))
775 @result{} ("/bin/csh" "-i") 775 @result{} ("bash" "-i")
776@end group 776@end group
777@end smallexample 777@end smallexample
778@end defun 778@end defun
@@ -780,11 +780,10 @@ were given to the program.
780@defun process-contact process &optional key 780@defun process-contact process &optional key
781 781
782This function returns information about how a network or serial 782This function returns information about how a network or serial
783process was set up. For a network process, when @var{key} is 783process was set up. When @var{key} is @code{nil}, it returns
784@code{nil}, it returns @code{(@var{hostname} @var{service})} which 784@code{(@var{hostname} @var{service})} for a network process, and
785specifies what you connected to. For a serial process, when @var{key} 785@code{(@var{port} @var{speed})} for a serial process.
786is @code{nil}, it returns @code{(@var{port} @var{speed})}. For an 786For an ordinary child process, this function always returns @code{t}.
787ordinary child process, this function always returns @code{t}.
788 787
789If @var{key} is @code{t}, the value is the complete status information 788If @var{key} is @code{t}, the value is the complete status information
790for the connection, server, or serial port; that is, the list of 789for the connection, server, or serial port; that is, the list of
@@ -792,7 +791,8 @@ keywords and values specified in @code{make-network-process} or
792@code{make-serial-process}, except that some of the values represent 791@code{make-serial-process}, except that some of the values represent
793the current status instead of what you specified. 792the current status instead of what you specified.
794 793
795For a network process: 794For a network process, the values include (see
795@code{make-network-process} for a complete list):
796 796
797@table @code 797@table @code
798@item :buffer 798@item :buffer
@@ -829,7 +829,7 @@ process is started and remains constant as long as the process exists.
829@end defun 829@end defun
830 830
831@defun process-name process 831@defun process-name process
832This function returns the name of @var{process}. 832This function returns the name of @var{process}, as a string.
833@end defun 833@end defun
834 834
835@defun process-status process-name 835@defun process-status process-name
@@ -869,12 +869,6 @@ if @var{process-name} is not the name of an existing process.
869(process-status (get-buffer "*shell*")) 869(process-status (get-buffer "*shell*"))
870 @result{} run 870 @result{} run
871@end group 871@end group
872@group
873x
874 @result{} #<process xx<1>>
875(process-status x)
876 @result{} exit
877@end group
878@end smallexample 872@end smallexample
879 873
880For a network connection, @code{process-status} returns one of the symbols 874For a network connection, @code{process-status} returns one of the symbols
@@ -912,13 +906,9 @@ the remote host is provided as process property @code{remote-tty}.
912 906
913@defun process-coding-system process 907@defun process-coding-system process
914@anchor{Coding systems for a subprocess} 908@anchor{Coding systems for a subprocess}
915This function returns a cons cell describing the coding systems in use 909This function returns a cons cell @code{(@var{decode} . @var{encode})},
916for decoding output from @var{process} and for encoding input to 910describing the coding systems in use for decoding output from, and
917@var{process} (@pxref{Coding Systems}). The value has this form: 911encoding input to, @var{process} (@pxref{Coding Systems}).
918
919@example
920(@var{coding-system-for-decoding} . @var{coding-system-for-encoding})
921@end example
922@end defun 912@end defun
923 913
924@defun set-process-coding-system process &optional decoding-system encoding-system 914@defun set-process-coding-system process &optional decoding-system encoding-system
@@ -958,6 +948,7 @@ Emacs, which is done with the functions in this section. You must
958specify the process to send input to, and the input data to send. The 948specify the process to send input to, and the input data to send. The
959data appears on the ``standard input'' of the subprocess. 949data appears on the ``standard input'' of the subprocess.
960 950
951@c FIXME which?
961 Some operating systems have limited space for buffered input in a 952 Some operating systems have limited space for buffered input in a
962@acronym{PTY}. On these systems, Emacs sends an @acronym{EOF} 953@acronym{PTY}. On these systems, Emacs sends an @acronym{EOF}
963periodically amidst the other characters, to force them through. For 954periodically amidst the other characters, to force them through. For
@@ -984,26 +975,14 @@ the current buffer's process.
984 975
985@defun process-send-string process string 976@defun process-send-string process string
986This function sends @var{process} the contents of @var{string} as 977This function sends @var{process} the contents of @var{string} as
987standard input. If it is @code{nil}, the current buffer's process is used. 978standard input. It returns @code{nil}. For example, to make a
988 979Shell buffer list files:
989 The function returns @code{nil}.
990 980
991@smallexample 981@smallexample
992@group 982@group
993(process-send-string "shell<1>" "ls\n") 983(process-send-string "shell<1>" "ls\n")
994 @result{} nil 984 @result{} nil
995@end group 985@end group
996
997
998@group
999---------- Buffer: *shell* ----------
1000...
1001introduction.texi syntax-tables.texi~
1002introduction.texi~ text.texi
1003introduction.txt text.texi~
1004...
1005---------- Buffer: *shell* ----------
1006@end group
1007@end smallexample 986@end smallexample
1008@end defun 987@end defun
1009 988
@@ -1019,7 +998,6 @@ is unimportant which number is larger.)
1019@defun process-send-eof &optional process 998@defun process-send-eof &optional process
1020This function makes @var{process} see an end-of-file in its 999This function makes @var{process} see an end-of-file in its
1021input. The @acronym{EOF} comes after any text already sent to it. 1000input. The @acronym{EOF} comes after any text already sent to it.
1022
1023The function returns @var{process}. 1001The function returns @var{process}.
1024 1002
1025@smallexample 1003@smallexample
@@ -1050,7 +1028,7 @@ system. For example, the signal @code{SIGINT} means that the user has
1050typed @kbd{C-c}, or that some analogous thing has happened. 1028typed @kbd{C-c}, or that some analogous thing has happened.
1051 1029
1052 Each signal has a standard effect on the subprocess. Most signals 1030 Each signal has a standard effect on the subprocess. Most signals
1053kill the subprocess, but some stop or resume execution instead. Most 1031kill the subprocess, but some stop (or resume) execution instead. Most
1054signals can optionally be handled by programs; if the program handles 1032signals can optionally be handled by programs; if the program handles
1055the signal, then we can say nothing in general about its effects. 1033the signal, then we can say nothing in general about its effects.
1056 1034
@@ -1059,7 +1037,7 @@ section. Emacs also sends signals automatically at certain times:
1059killing a buffer sends a @code{SIGHUP} signal to all its associated 1037killing a buffer sends a @code{SIGHUP} signal to all its associated
1060processes; killing Emacs sends a @code{SIGHUP} signal to all remaining 1038processes; killing Emacs sends a @code{SIGHUP} signal to all remaining
1061processes. (@code{SIGHUP} is a signal that usually indicates that the 1039processes. (@code{SIGHUP} is a signal that usually indicates that the
1062user hung up the phone.) 1040user ``hung up the phone'', i.e., disconnected.)
1063 1041
1064 Each of the signal-sending functions takes two optional arguments: 1042 Each of the signal-sending functions takes two optional arguments:
1065@var{process} and @var{current-group}. 1043@var{process} and @var{current-group}.
@@ -1103,6 +1081,8 @@ and cannot be handled by the subprocess.
1103@defun quit-process &optional process current-group 1081@defun quit-process &optional process current-group
1104This function sends the signal @code{SIGQUIT} to the process 1082This function sends the signal @code{SIGQUIT} to the process
1105@var{process}. This signal is the one sent by the ``quit 1083@var{process}. This signal is the one sent by the ``quit
1084@c FIXME? Never heard of C-b being used for this. In readline, eg
1085@c bash, that is backward-word.
1106character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside 1086character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside
1107Emacs. 1087Emacs.
1108@end defun 1088@end defun
@@ -1127,11 +1107,12 @@ stopped previously.
1127 1107
1128@defun signal-process process signal 1108@defun signal-process process signal
1129This function sends a signal to process @var{process}. The argument 1109This function sends a signal to process @var{process}. The argument
1130@var{signal} specifies which signal to send; it should be an integer. 1110@var{signal} specifies which signal to send; it should be an integer,
1111or a symbol whose name is a signal.
1131 1112
1132The @var{process} argument can be a system process @acronym{ID}; that 1113The @var{process} argument can be a system process @acronym{ID} (an
1133allows you to send signals to processes that are not children of 1114integer); that allows you to send signals to processes that are not
1134Emacs. @xref{System Processes}. 1115children of Emacs. @xref{System Processes}.
1135@end defun 1116@end defun
1136 1117
1137@node Output from Processes 1118@node Output from Processes
@@ -1141,10 +1122,10 @@ Emacs. @xref{System Processes}.
1141 1122
1142 There are two ways to receive the output that a subprocess writes to 1123 There are two ways to receive the output that a subprocess writes to
1143its standard output stream. The output can be inserted in a buffer, 1124its standard output stream. The output can be inserted in a buffer,
1144which is called the associated buffer of the process, or a function 1125which is called the associated buffer of the process (@pxref{Process
1145called the @dfn{filter function} can be called to act on the output. If 1126Buffers}), or a function called the @dfn{filter function} can be
1146the process has no buffer and no filter function, its output is 1127called to act on the output. If the process has no buffer and no
1147discarded. 1128filter function, its output is discarded.
1148 1129
1149 When a subprocess terminates, Emacs reads any pending output, 1130 When a subprocess terminates, Emacs reads any pending output,
1150then stops reading output from that subprocess. Therefore, if the 1131then stops reading output from that subprocess. Therefore, if the
@@ -1164,7 +1145,7 @@ primitive that waits.
1164On some systems, when Emacs reads the output from a subprocess, the 1145On some systems, when Emacs reads the output from a subprocess, the
1165output data is read in very small blocks, potentially resulting in 1146output data is read in very small blocks, potentially resulting in
1166very poor performance. This behavior can be remedied to some extent 1147very poor performance. This behavior can be remedied to some extent
1167by setting the variable @var{process-adaptive-read-buffering} to a 1148by setting the variable @code{process-adaptive-read-buffering} to a
1168non-@code{nil} value (the default), as it will automatically delay reading 1149non-@code{nil} value (the default), as it will automatically delay reading
1169from such processes, thus allowing them to produce more output before 1150from such processes, thus allowing them to produce more output before
1170Emacs tries to read it. 1151Emacs tries to read it.
@@ -1233,9 +1214,9 @@ to insert, and updates it to point after the inserted text. That is why
1233successive batches of output are inserted consecutively. 1214successive batches of output are inserted consecutively.
1234 1215
1235Filter functions normally should use this marker in the same fashion 1216Filter functions normally should use this marker in the same fashion
1236as is done by direct insertion of output in the buffer. A good 1217as is done by direct insertion of output in the buffer. For an
1237example of a filter function that uses @code{process-mark} is found at 1218example of a filter function that uses @code{process-mark},
1238the end of the following section. 1219@pxref{Process Filter Example}.
1239 1220
1240When the user is expected to enter input in the process buffer for 1221When the user is expected to enter input in the process buffer for
1241transmission to the process, the process marker separates the new input 1222transmission to the process, the process marker separates the new input
@@ -1301,19 +1282,20 @@ cases, the right way to do this is with the macro
1301 If an error happens during execution of a filter function, it is 1282 If an error happens during execution of a filter function, it is
1302caught automatically, so that it doesn't stop the execution of whatever 1283caught automatically, so that it doesn't stop the execution of whatever
1303program was running when the filter function was started. However, if 1284program was running when the filter function was started. However, if
1304@code{debug-on-error} is non-@code{nil}, the error-catching is turned 1285@code{debug-on-error} is non-@code{nil}, errors are not caught.
1305off. This makes it possible to use the Lisp debugger to debug the 1286This makes it possible to use the Lisp debugger to debug the
1306filter function. @xref{Debugger}. 1287filter function. @xref{Debugger}.
1307 1288
1308 Many filter functions sometimes or always insert the text in the 1289 Many filter functions sometimes (or always) insert the output in the
1309process's buffer, mimicking the actions of Emacs when there is no 1290process's buffer, mimicking the actions of Emacs when there is no
1310filter. Such filter functions need to use @code{set-buffer} in order to 1291filter. Such filter functions need to make sure that they save the
1311be sure to insert in that buffer. To avoid setting the current buffer 1292current buffer, select the correct buffer (if different) before
1312semipermanently, these filter functions must save and restore the 1293inserting output, and then restore the original buffer.
1313current buffer. They should also check whether the buffer is still 1294They should also check whether the buffer is still alive, update the
1314alive, update the process marker, and in some cases update the value 1295process marker, and in some cases update the value of point. Here is
1315of point. Here is how to do these things: 1296how to do these things:
1316 1297
1298@anchor{Process Filter Example}
1317@smallexample 1299@smallexample
1318@group 1300@group
1319(defun ordinary-insertion-filter (proc string) 1301(defun ordinary-insertion-filter (proc string)
@@ -1323,7 +1305,7 @@ of point. Here is how to do these things:
1323@end group 1305@end group
1324@group 1306@group
1325 (save-excursion 1307 (save-excursion
1326 ;; @r{Insert the text, advancing the process marker.} 1308 ;; @r{Insert the text, advancing the process marker.}
1327 (goto-char (process-mark proc)) 1309 (goto-char (process-mark proc))
1328 (insert string) 1310 (insert string)
1329 (set-marker (process-mark proc) (point))) 1311 (set-marker (process-mark proc) (point)))
@@ -1331,14 +1313,8 @@ of point. Here is how to do these things:
1331@end group 1313@end group
1332@end smallexample 1314@end smallexample
1333 1315
1334@noindent
1335The reason to use @code{with-current-buffer}, rather than using
1336@code{save-excursion} to save and restore the current buffer, is so as
1337to preserve the change in point made by the second call to
1338@code{goto-char}.
1339
1340 To make the filter force the process buffer to be visible whenever new 1316 To make the filter force the process buffer to be visible whenever new
1341text arrives, insert the following line just before the 1317text arrives, you could insert a line like the following just before the
1342@code{with-current-buffer} construct: 1318@code{with-current-buffer} construct:
1343 1319
1344@smallexample 1320@smallexample
@@ -1349,12 +1325,16 @@ text arrives, insert the following line just before the
1349previously, eliminate the variable @code{moving} and call 1325previously, eliminate the variable @code{moving} and call
1350@code{goto-char} unconditionally. 1326@code{goto-char} unconditionally.
1351 1327
1328@ignore
1352 In earlier Emacs versions, every filter function that did regular 1329 In earlier Emacs versions, every filter function that did regular
1353expression searching or matching had to explicitly save and restore the 1330expression searching or matching had to explicitly save and restore the
1354match data. Now Emacs does this automatically for filter functions; 1331match data. Now Emacs does this automatically for filter functions;
1355they never need to do it explicitly. @xref{Match Data}. 1332they never need to do it explicitly.
1333@end ignore
1334 Note that Emacs automatically saves and restores the match data
1335while executing filter functions. @xref{Match Data}.
1356 1336
1357 The output to the function may come in chunks of any size. A program 1337 The output to the filter may come in chunks of any size. A program
1358that produces the same output twice in a row may send it as one batch of 1338that produces the same output twice in a row may send it as one batch of
1359200 characters one time, and five batches of 40 characters the next. If 1339200 characters one time, and five batches of 40 characters the next. If
1360the filter looks for certain text strings in the subprocess output, make 1340the filter looks for certain text strings in the subprocess output, make
@@ -1372,7 +1352,7 @@ This function returns the filter function of @var{process}, or @code{nil}
1372if it has none. 1352if it has none.
1373@end defun 1353@end defun
1374 1354
1375 Here is an example of use of a filter function: 1355 Here is an example of the use of a filter function:
1376 1356
1377@smallexample 1357@smallexample
1378@group 1358@group
@@ -1392,7 +1372,7 @@ if it has none.
1392(process-send-string "shell" "ls ~/other\n") 1372(process-send-string "shell" "ls ~/other\n")
1393 @result{} nil 1373 @result{} nil
1394kept 1374kept
1395 @result{} ("lewis@@slug[8] % " 1375 @result{} ("lewis@@slug:$ "
1396@end group 1376@end group
1397@group 1377@group
1398"FINAL-W87-SHORT.MSS backup.otl kolstad.mss~ 1378"FINAL-W87-SHORT.MSS backup.otl kolstad.mss~
@@ -1448,8 +1428,8 @@ bytes, Emacs by default uses @code{no-conversion} for it; see
1448@ref{Lisp and Coding Systems, inhibit-null-byte-detection}, for how to 1428@ref{Lisp and Coding Systems, inhibit-null-byte-detection}, for how to
1449control this behavior. 1429control this behavior.
1450 1430
1451 @strong{Warning:} Coding systems such as @code{undecided} which 1431 @strong{Warning:} Coding systems such as @code{undecided}, which
1452determine the coding system from the data do not work entirely 1432determine the coding system from the data, do not work entirely
1453reliably with asynchronous subprocess output. This is because Emacs 1433reliably with asynchronous subprocess output. This is because Emacs
1454has to process asynchronous subprocess output in batches, as it 1434has to process asynchronous subprocess output in batches, as it
1455arrives. Emacs must try to detect the proper coding system from one 1435arrives. Emacs must try to detect the proper coding system from one
@@ -1467,7 +1447,7 @@ output as a multibyte string or as a unibyte string according to the
1467process's filter coding system. Emacs 1447process's filter coding system. Emacs
1468decodes the output according to the process output coding system, 1448decodes the output according to the process output coding system,
1469which usually produces a multibyte string, except for coding systems 1449which usually produces a multibyte string, except for coding systems
1470such as @code{binary} and @code{raw-text} 1450such as @code{binary} and @code{raw-text}.
1471 1451
1472@node Accepting Output 1452@node Accepting Output
1473@subsection Accepting Output from Processes 1453@subsection Accepting Output from Processes