aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-02-27 00:09:08 +0000
committerRichard M. Stallman2005-02-27 00:09:08 +0000
commitfea5a6d51abac85d8a8b877a1c203dcac488da0c (patch)
treeb42809707b54ca5c5c3619c5acdefe66571ce792
parent9775b55021a532d8c8b3d233bc2906bd2d64d7ac (diff)
downloademacs-fea5a6d51abac85d8a8b877a1c203dcac488da0c.tar.gz
emacs-fea5a6d51abac85d8a8b877a1c203dcac488da0c.zip
(Subprocess Creation): Explain nil in exec-path. Cleanup.
(Deleting Processes): Cleanups, add xref. (Process Information): set-process-coding-system, some args optional. (Input to Processes): Explain various types for PROCESS args. Rename them from PROCESS-NAME to PROCESS. (Signals to Processes): Likewise. (Decoding Output): Cleanup. (Query Before Exit): Clarify.
-rw-r--r--lispref/processes.texi123
1 files changed, 61 insertions, 62 deletions
diff --git a/lispref/processes.texi b/lispref/processes.texi
index d0d65fbfc2d..2db9cd05b95 100644
--- a/lispref/processes.texi
+++ b/lispref/processes.texi
@@ -77,11 +77,12 @@ cannot be executed. If the file name is relative, the variable
77@code{exec-path} contains a list of directories to search. Emacs 77@code{exec-path} contains a list of directories to search. Emacs
78initializes @code{exec-path} when it starts up, based on the value of 78initializes @code{exec-path} when it starts up, based on the value of
79the environment variable @code{PATH}. The standard file name 79the environment variable @code{PATH}. The standard file name
80constructs, @samp{~}, @samp{.}, and @samp{..}, are interpreted as usual 80constructs, @samp{~}, @samp{.}, and @samp{..}, are interpreted as
81in @code{exec-path}, but environment variable substitutions 81usual in @code{exec-path}, but environment variable substitutions
82(@samp{$HOME}, etc.) are not recognized; use 82(@samp{$HOME}, etc.) are not recognized; use
83@code{substitute-in-file-name} to perform them (@pxref{File Name 83@code{substitute-in-file-name} to perform them (@pxref{File Name
84Expansion}). 84Expansion}). @code{nil} in this list refers to
85@code{default-directory}.
85 86
86 Executing a program can also try adding suffixes to the specified 87 Executing a program can also try adding suffixes to the specified
87name: 88name:
@@ -93,6 +94,10 @@ want the name to be tried exactly as specified. The default value is
93system-dependent. 94system-dependent.
94@end defvar 95@end defvar
95 96
97 @strong{Please note:} The argument @var{program} contains only the
98name of the program; it may not contain any command-line arguments. You
99must use @var{args} to provide those.
100
96 Each of the subprocess-creating functions has a @var{buffer-or-name} 101 Each of the subprocess-creating functions has a @var{buffer-or-name}
97argument which specifies where the standard output from the program will 102argument which specifies where the standard output from the program will
98go. It should be a buffer or a buffer name; if it is a buffer name, 103go. It should be a buffer or a buffer name; if it is a buffer name,
@@ -107,12 +112,7 @@ same buffer because their output would be intermixed randomly.
107argument, @var{args}. The @var{args} must all be strings, and they are 112argument, @var{args}. The @var{args} must all be strings, and they are
108supplied to @var{program} as separate command line arguments. Wildcard 113supplied to @var{program} as separate command line arguments. Wildcard
109characters and other shell constructs have no special meanings in these 114characters and other shell constructs have no special meanings in these
110strings, since the whole strings are passed directly to the specified 115strings, since the strings are passed directly to the specified program.
111program.
112
113 @strong{Please note:} The argument @var{program} contains only the
114name of the program; it may not contain any command-line arguments. You
115must use @var{args} to provide those.
116 116
117 The subprocess gets its current directory from the value of 117 The subprocess gets its current directory from the value of
118@code{default-directory} (@pxref{File Name Expansion}). 118@code{default-directory} (@pxref{File Name Expansion}).
@@ -547,17 +547,16 @@ Information}).
547subprocess. Processes are deleted automatically after they terminate, 547subprocess. Processes are deleted automatically after they terminate,
548but not necessarily right away. You can delete a process explicitly 548but not necessarily right away. You can delete a process explicitly
549at any time. If you delete a terminated process explicitly before it 549at any time. If you delete a terminated process explicitly before it
550is deleted automatically, no harm results. Deletion of a running 550is deleted automatically, no harm results. Deleting a running
551process sends a signal to terminate it (and its child processes if 551process sends a signal to terminate it (and its child processes if
552any), and calls the process sentinel if it has one. 552any), and calls the process sentinel if it has one. @xref{Sentinels}.
553 553
554 @code{get-buffer-process} and @code{process-list} do not remember a 554 When a process is deleted, the process object itself continues to
555deleted process, but the process object itself continues to exist as 555exist as long as other Lisp objects point to it. All the Lisp
556long as other Lisp objects point to it. All the Lisp primitives that 556primitives that work on process objects accept deleted processes, but
557work on process objects accept deleted processes, but those that do 557those that do I/O or send signals will report an error. The process
558I/O or send signals will report an error. The process mark continues 558mark continues to point to the same place as before, usually into a
559to point to the same place as before, usually into a buffer where 559buffer where output from the process was being inserted.
560output from the process was being inserted.
561 560
562@defopt delete-exited-processes 561@defopt delete-exited-processes
563This variable controls automatic deletion of processes that have 562This variable controls automatic deletion of processes that have
@@ -567,15 +566,16 @@ terminated (due to calling @code{exit} or to a signal). If it is
567they exit. 566they exit.
568@end defopt 567@end defopt
569 568
570@defun delete-process name 569@defun delete-process process
571This function deletes the process associated with @var{name}, killing 570This function deletes a process, killing it with a @code{SIGKILL}
572it with a @code{SIGKILL} signal. The argument @var{name} may be a 571signal. The argument may be a process, the name of a process, a
573process, the name of a process, a buffer, or the name of a buffer. 572buffer, or the name of a buffer. (A buffer or buffer-name stands for
574Calling @code{delete-process} on a running process terminates it, 573the process that @code{get-buffer-process} returns.) Calling
575updates the process status, and runs the sentinel (if any) immediately. 574@code{delete-process} on a running process terminates it, updates the
576If the process has already terminated, calling @code{delete-process} 575process status, and runs the sentinel (if any) immediately. If the
577has no effect on its status, or on the running of its sentinel (which 576process has already terminated, calling @code{delete-process} has no
578will happen sooner or later). 577effect on its status, or on the running of its sentinel (which will
578happen sooner or later).
579 579
580@smallexample 580@smallexample
581@group 581@group
@@ -728,7 +728,7 @@ for decoding output from @var{process} and for encoding input to
728@end example 728@end example
729@end defun 729@end defun
730 730
731@defun set-process-coding-system process decoding-system encoding-system 731@defun set-process-coding-system process &optional decoding-system encoding-system
732This function specifies the coding systems to use for subsequent output 732This function specifies the coding systems to use for subsequent output
733from and input to @var{process}. It will use @var{decoding-system} to 733from and input to @var{process}. It will use @var{decoding-system} to
734decode subprocess output, and @var{encoding-system} to encode subprocess 734decode subprocess output, and @var{encoding-system} to encode subprocess
@@ -784,11 +784,14 @@ again. This gives the subprocess a chance to read more of its pending
784input and make space in the buffer. It also allows filters, sentinels 784input and make space in the buffer. It also allows filters, sentinels
785and timers to run---so take account of that in writing your code. 785and timers to run---so take account of that in writing your code.
786 786
787@defun process-send-string process-name string 787 In these functions, the @var{process} argument can be a process or
788This function sends @var{process-name} the contents of @var{string} as 788the name of a process, or a buffer or buffer name (which stands
789standard input. The argument @var{process-name} must be a process or 789for a process via @code{get-buffer-process}). @code{nil} means
790the name of a process. If it is @code{nil}, the current buffer's 790the current buffer's process.
791process is used. 791
792@defun process-send-string process string
793This function sends @var{process} the contents of @var{string} as
794standard input. If it is @code{nil}, the current buffer's process is used.
792 795
793 The function returns @code{nil}. 796 The function returns @code{nil}.
794 797
@@ -811,26 +814,20 @@ introduction.txt text.texi~
811@end smallexample 814@end smallexample
812@end defun 815@end defun
813 816
814@defun process-send-region process-name start end 817@defun process-send-region process start end
815This function sends the text in the region defined by @var{start} and 818This function sends the text in the region defined by @var{start} and
816@var{end} as standard input to @var{process-name}, which is a process or 819@var{end} as standard input to @var{process}.
817a process name. (If it is @code{nil}, the current buffer's process is
818used.)
819 820
820An error is signaled unless both @var{start} and @var{end} are 821An error is signaled unless both @var{start} and @var{end} are
821integers or markers that indicate positions in the current buffer. (It 822integers or markers that indicate positions in the current buffer. (It
822is unimportant which number is larger.) 823is unimportant which number is larger.)
823@end defun 824@end defun
824 825
825@defun process-send-eof &optional process-name 826@defun process-send-eof &optional process
826 This function makes @var{process-name} see an end-of-file in its 827This function makes @var{process} see an end-of-file in its
827input. The @acronym{EOF} comes after any text already sent to it. 828input. The @acronym{EOF} comes after any text already sent to it.
828 829
829 If @var{process-name} is not supplied, or if it is @code{nil}, then 830The function returns @var{process}.
830this function sends the @acronym{EOF} to the current buffer's process. An
831error is signaled if the current buffer has no process.
832
833 The function returns @var{process-name}.
834 831
835@smallexample 832@smallexample
836@group 833@group
@@ -875,10 +872,11 @@ user hung up the phone.)
875 Each of the signal-sending functions takes two optional arguments: 872 Each of the signal-sending functions takes two optional arguments:
876@var{process-name} and @var{current-group}. 873@var{process-name} and @var{current-group}.
877 874
878 The argument @var{process-name} must be either a process, the name of 875 The argument @var{process} must be either a process, a process
879one, or @code{nil}. If it is @code{nil}, the process defaults to the 876name, a buffer, a buffer name, or @code{nil}. A buffer or buffer name
880process associated with the current buffer. An error is signaled if 877stands for a process through @code{get-buffer-process}. @code{nil}
881@var{process-name} does not identify a process. 878stands for the process associated with the current buffer. An error
879is signaled if @var{process} does not identify a process.
882 880
883 The argument @var{current-group} is a flag that makes a difference 881 The argument @var{current-group} is a flag that makes a difference
884when you are running a job-control shell as an Emacs subprocess. If it 882when you are running a job-control shell as an Emacs subprocess. If it
@@ -895,8 +893,8 @@ support the distinction in the case of pipes. For the same reason,
895job-control shells won't work when a pipe is used. See 893job-control shells won't work when a pipe is used. See
896@code{process-connection-type} in @ref{Asynchronous Processes}. 894@code{process-connection-type} in @ref{Asynchronous Processes}.
897 895
898@defun interrupt-process &optional process-name current-group 896@defun interrupt-process &optional process current-group
899This function interrupts the process @var{process-name} by sending the 897This function interrupts the process @var{process} by sending the
900signal @code{SIGINT}. Outside of Emacs, typing the ``interrupt 898signal @code{SIGINT}. Outside of Emacs, typing the ``interrupt
901character'' (normally @kbd{C-c} on some systems, and @code{DEL} on 899character'' (normally @kbd{C-c} on some systems, and @code{DEL} on
902others) sends this signal. When the argument @var{current-group} is 900others) sends this signal. When the argument @var{current-group} is
@@ -904,21 +902,21 @@ non-@code{nil}, you can think of this function as ``typing @kbd{C-c}''
904on the terminal by which Emacs talks to the subprocess. 902on the terminal by which Emacs talks to the subprocess.
905@end defun 903@end defun
906 904
907@defun kill-process &optional process-name current-group 905@defun kill-process &optional process current-group
908This function kills the process @var{process-name} by sending the 906This function kills the process @var{process} by sending the
909signal @code{SIGKILL}. This signal kills the subprocess immediately, 907signal @code{SIGKILL}. This signal kills the subprocess immediately,
910and cannot be handled by the subprocess. 908and cannot be handled by the subprocess.
911@end defun 909@end defun
912 910
913@defun quit-process &optional process-name current-group 911@defun quit-process &optional process current-group
914This function sends the signal @code{SIGQUIT} to the process 912This function sends the signal @code{SIGQUIT} to the process
915@var{process-name}. This signal is the one sent by the ``quit 913@var{process}. This signal is the one sent by the ``quit
916character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside 914character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside
917Emacs. 915Emacs.
918@end defun 916@end defun
919 917
920@defun stop-process &optional process-name current-group 918@defun stop-process &optional process current-group
921This function stops the process @var{process-name} by sending the 919This function stops the process @var{process} by sending the
922signal @code{SIGTSTP}. Use @code{continue-process} to resume its 920signal @code{SIGTSTP}. Use @code{continue-process} to resume its
923execution. 921execution.
924 922
@@ -929,9 +927,9 @@ Outside of Emacs, on systems with job control, the ``stop character''
929subprocess. 927subprocess.
930@end defun 928@end defun
931 929
932@defun continue-process &optional process-name current-group 930@defun continue-process &optional process current-group
933This function resumes execution of the process @var{process} by sending 931This function resumes execution of the process @var{process} by sending
934it the signal @code{SIGCONT}. This presumes that @var{process-name} was 932it the signal @code{SIGCONT}. This presumes that @var{process} was
935stopped previously. 933stopped previously.
936@end defun 934@end defun
937 935
@@ -940,8 +938,9 @@ stopped previously.
940This function sends a signal to process @var{process}. The argument 938This function sends a signal to process @var{process}. The argument
941@var{signal} specifies which signal to send; it should be an integer. 939@var{signal} specifies which signal to send; it should be an integer.
942 940
943You can specify the target process by its process @acronym{ID}; that allows 941The @var{process} argument can be a system process @acronym{ID}; that
944you to send signals to processes that are not children of Emacs. 942allows you to send signals to processes that are not children of
943Emacs.
945@end defun 944@end defun
946 945
947@node Output from Processes 946@node Output from Processes
@@ -1240,7 +1239,7 @@ there is no filter function:
1240it decodes the output according to the process output coding system. 1239it decodes the output according to the process output coding system.
1241If the coding system is @code{raw-text} or @code{no-conversion}, Emacs 1240If the coding system is @code{raw-text} or @code{no-conversion}, Emacs
1242converts the unibyte output to multibyte using 1241converts the unibyte output to multibyte using
1243@code{string-to-multibyte}, inserts the resulting multibyte text. 1242@code{string-to-multibyte}, and inserts the resulting multibyte text.
1244 1243
1245 You can use @code{set-process-coding-system} to specify which coding 1244 You can use @code{set-process-coding-system} to specify which coding
1246system to use (@pxref{Process Information}). Otherwise, the coding 1245system to use (@pxref{Process Information}). Otherwise, the coding
@@ -1443,7 +1442,7 @@ was not.
1443@section Querying Before Exit 1442@section Querying Before Exit
1444 1443
1445 When Emacs exits, it terminates all its subprocesses by sending them 1444 When Emacs exits, it terminates all its subprocesses by sending them
1446the @code{SIGHUP} signal. Because some subprocesses are doing 1445the @code{SIGHUP} signal. Because subprocesses may be doing
1447valuable work, Emacs normally asks the user to confirm that it is ok 1446valuable work, Emacs normally asks the user to confirm that it is ok
1448to terminate them. Each process has a query flag which, if 1447to terminate them. Each process has a query flag which, if
1449non-@code{nil}, says that Emacs should ask for confirmation before 1448non-@code{nil}, says that Emacs should ask for confirmation before