diff options
| author | Richard M. Stallman | 2005-02-27 00:09:08 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-02-27 00:09:08 +0000 |
| commit | fea5a6d51abac85d8a8b877a1c203dcac488da0c (patch) | |
| tree | b42809707b54ca5c5c3619c5acdefe66571ce792 | |
| parent | 9775b55021a532d8c8b3d233bc2906bd2d64d7ac (diff) | |
| download | emacs-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.texi | 123 |
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 |
| 78 | initializes @code{exec-path} when it starts up, based on the value of | 78 | initializes @code{exec-path} when it starts up, based on the value of |
| 79 | the environment variable @code{PATH}. The standard file name | 79 | the environment variable @code{PATH}. The standard file name |
| 80 | constructs, @samp{~}, @samp{.}, and @samp{..}, are interpreted as usual | 80 | constructs, @samp{~}, @samp{.}, and @samp{..}, are interpreted as |
| 81 | in @code{exec-path}, but environment variable substitutions | 81 | usual 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 |
| 84 | Expansion}). | 84 | Expansion}). @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 |
| 87 | name: | 88 | name: |
| @@ -93,6 +94,10 @@ want the name to be tried exactly as specified. The default value is | |||
| 93 | system-dependent. | 94 | system-dependent. |
| 94 | @end defvar | 95 | @end defvar |
| 95 | 96 | ||
| 97 | @strong{Please note:} The argument @var{program} contains only the | ||
| 98 | name of the program; it may not contain any command-line arguments. You | ||
| 99 | must 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} |
| 97 | argument which specifies where the standard output from the program will | 102 | argument which specifies where the standard output from the program will |
| 98 | go. It should be a buffer or a buffer name; if it is a buffer name, | 103 | go. 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. | |||
| 107 | argument, @var{args}. The @var{args} must all be strings, and they are | 112 | argument, @var{args}. The @var{args} must all be strings, and they are |
| 108 | supplied to @var{program} as separate command line arguments. Wildcard | 113 | supplied to @var{program} as separate command line arguments. Wildcard |
| 109 | characters and other shell constructs have no special meanings in these | 114 | characters and other shell constructs have no special meanings in these |
| 110 | strings, since the whole strings are passed directly to the specified | 115 | strings, since the strings are passed directly to the specified program. |
| 111 | program. | ||
| 112 | |||
| 113 | @strong{Please note:} The argument @var{program} contains only the | ||
| 114 | name of the program; it may not contain any command-line arguments. You | ||
| 115 | must 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}). | |||
| 547 | subprocess. Processes are deleted automatically after they terminate, | 547 | subprocess. Processes are deleted automatically after they terminate, |
| 548 | but not necessarily right away. You can delete a process explicitly | 548 | but not necessarily right away. You can delete a process explicitly |
| 549 | at any time. If you delete a terminated process explicitly before it | 549 | at any time. If you delete a terminated process explicitly before it |
| 550 | is deleted automatically, no harm results. Deletion of a running | 550 | is deleted automatically, no harm results. Deleting a running |
| 551 | process sends a signal to terminate it (and its child processes if | 551 | process sends a signal to terminate it (and its child processes if |
| 552 | any), and calls the process sentinel if it has one. | 552 | any), 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 |
| 555 | deleted process, but the process object itself continues to exist as | 555 | exist as long as other Lisp objects point to it. All the Lisp |
| 556 | long as other Lisp objects point to it. All the Lisp primitives that | 556 | primitives that work on process objects accept deleted processes, but |
| 557 | work on process objects accept deleted processes, but those that do | 557 | those that do I/O or send signals will report an error. The process |
| 558 | I/O or send signals will report an error. The process mark continues | 558 | mark continues to point to the same place as before, usually into a |
| 559 | to point to the same place as before, usually into a buffer where | 559 | buffer where output from the process was being inserted. |
| 560 | output from the process was being inserted. | ||
| 561 | 560 | ||
| 562 | @defopt delete-exited-processes | 561 | @defopt delete-exited-processes |
| 563 | This variable controls automatic deletion of processes that have | 562 | This 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 | |||
| 567 | they exit. | 566 | they exit. |
| 568 | @end defopt | 567 | @end defopt |
| 569 | 568 | ||
| 570 | @defun delete-process name | 569 | @defun delete-process process |
| 571 | This function deletes the process associated with @var{name}, killing | 570 | This function deletes a process, killing it with a @code{SIGKILL} |
| 572 | it with a @code{SIGKILL} signal. The argument @var{name} may be a | 571 | signal. The argument may be a process, the name of a process, a |
| 573 | process, the name of a process, a buffer, or the name of a buffer. | 572 | buffer, or the name of a buffer. (A buffer or buffer-name stands for |
| 574 | Calling @code{delete-process} on a running process terminates it, | 573 | the process that @code{get-buffer-process} returns.) Calling |
| 575 | updates the process status, and runs the sentinel (if any) immediately. | 574 | @code{delete-process} on a running process terminates it, updates the |
| 576 | If the process has already terminated, calling @code{delete-process} | 575 | process status, and runs the sentinel (if any) immediately. If the |
| 577 | has no effect on its status, or on the running of its sentinel (which | 576 | process has already terminated, calling @code{delete-process} has no |
| 578 | will happen sooner or later). | 577 | effect on its status, or on the running of its sentinel (which will |
| 578 | happen 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 |
| 732 | This function specifies the coding systems to use for subsequent output | 732 | This function specifies the coding systems to use for subsequent output |
| 733 | from and input to @var{process}. It will use @var{decoding-system} to | 733 | from and input to @var{process}. It will use @var{decoding-system} to |
| 734 | decode subprocess output, and @var{encoding-system} to encode subprocess | 734 | decode 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 | |||
| 784 | input and make space in the buffer. It also allows filters, sentinels | 784 | input and make space in the buffer. It also allows filters, sentinels |
| 785 | and timers to run---so take account of that in writing your code. | 785 | and 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 |
| 788 | This function sends @var{process-name} the contents of @var{string} as | 788 | the name of a process, or a buffer or buffer name (which stands |
| 789 | standard input. The argument @var{process-name} must be a process or | 789 | for a process via @code{get-buffer-process}). @code{nil} means |
| 790 | the name of a process. If it is @code{nil}, the current buffer's | 790 | the current buffer's process. |
| 791 | process is used. | 791 | |
| 792 | @defun process-send-string process string | ||
| 793 | This function sends @var{process} the contents of @var{string} as | ||
| 794 | standard 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 |
| 815 | This function sends the text in the region defined by @var{start} and | 818 | This 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}. |
| 817 | a process name. (If it is @code{nil}, the current buffer's process is | ||
| 818 | used.) | ||
| 819 | 820 | ||
| 820 | An error is signaled unless both @var{start} and @var{end} are | 821 | An error is signaled unless both @var{start} and @var{end} are |
| 821 | integers or markers that indicate positions in the current buffer. (It | 822 | integers or markers that indicate positions in the current buffer. (It |
| 822 | is unimportant which number is larger.) | 823 | is 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 | 827 | This function makes @var{process} see an end-of-file in its |
| 827 | input. The @acronym{EOF} comes after any text already sent to it. | 828 | input. 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 | 830 | The function returns @var{process}. |
| 830 | this function sends the @acronym{EOF} to the current buffer's process. An | ||
| 831 | error 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 |
| 879 | one, or @code{nil}. If it is @code{nil}, the process defaults to the | 876 | name, a buffer, a buffer name, or @code{nil}. A buffer or buffer name |
| 880 | process associated with the current buffer. An error is signaled if | 877 | stands for a process through @code{get-buffer-process}. @code{nil} |
| 881 | @var{process-name} does not identify a process. | 878 | stands for the process associated with the current buffer. An error |
| 879 | is 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 |
| 884 | when you are running a job-control shell as an Emacs subprocess. If it | 882 | when 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, | |||
| 895 | job-control shells won't work when a pipe is used. See | 893 | job-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 |
| 899 | This function interrupts the process @var{process-name} by sending the | 897 | This function interrupts the process @var{process} by sending the |
| 900 | signal @code{SIGINT}. Outside of Emacs, typing the ``interrupt | 898 | signal @code{SIGINT}. Outside of Emacs, typing the ``interrupt |
| 901 | character'' (normally @kbd{C-c} on some systems, and @code{DEL} on | 899 | character'' (normally @kbd{C-c} on some systems, and @code{DEL} on |
| 902 | others) sends this signal. When the argument @var{current-group} is | 900 | others) 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}'' | |||
| 904 | on the terminal by which Emacs talks to the subprocess. | 902 | on 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 |
| 908 | This function kills the process @var{process-name} by sending the | 906 | This function kills the process @var{process} by sending the |
| 909 | signal @code{SIGKILL}. This signal kills the subprocess immediately, | 907 | signal @code{SIGKILL}. This signal kills the subprocess immediately, |
| 910 | and cannot be handled by the subprocess. | 908 | and 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 |
| 914 | This function sends the signal @code{SIGQUIT} to the process | 912 | This 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 |
| 916 | character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside | 914 | character'' (usually @kbd{C-b} or @kbd{C-\}) when you are not inside |
| 917 | Emacs. | 915 | Emacs. |
| 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 |
| 921 | This function stops the process @var{process-name} by sending the | 919 | This function stops the process @var{process} by sending the |
| 922 | signal @code{SIGTSTP}. Use @code{continue-process} to resume its | 920 | signal @code{SIGTSTP}. Use @code{continue-process} to resume its |
| 923 | execution. | 921 | execution. |
| 924 | 922 | ||
| @@ -929,9 +927,9 @@ Outside of Emacs, on systems with job control, the ``stop character'' | |||
| 929 | subprocess. | 927 | subprocess. |
| 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 |
| 933 | This function resumes execution of the process @var{process} by sending | 931 | This function resumes execution of the process @var{process} by sending |
| 934 | it the signal @code{SIGCONT}. This presumes that @var{process-name} was | 932 | it the signal @code{SIGCONT}. This presumes that @var{process} was |
| 935 | stopped previously. | 933 | stopped previously. |
| 936 | @end defun | 934 | @end defun |
| 937 | 935 | ||
| @@ -940,8 +938,9 @@ stopped previously. | |||
| 940 | This function sends a signal to process @var{process}. The argument | 938 | This 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 | ||
| 943 | You can specify the target process by its process @acronym{ID}; that allows | 941 | The @var{process} argument can be a system process @acronym{ID}; that |
| 944 | you to send signals to processes that are not children of Emacs. | 942 | allows you to send signals to processes that are not children of |
| 943 | Emacs. | ||
| 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: | |||
| 1240 | it decodes the output according to the process output coding system. | 1239 | it decodes the output according to the process output coding system. |
| 1241 | If the coding system is @code{raw-text} or @code{no-conversion}, Emacs | 1240 | If the coding system is @code{raw-text} or @code{no-conversion}, Emacs |
| 1242 | converts the unibyte output to multibyte using | 1241 | converts 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 |
| 1246 | system to use (@pxref{Process Information}). Otherwise, the coding | 1245 | system 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 |
| 1446 | the @code{SIGHUP} signal. Because some subprocesses are doing | 1445 | the @code{SIGHUP} signal. Because subprocesses may be doing |
| 1447 | valuable work, Emacs normally asks the user to confirm that it is ok | 1446 | valuable work, Emacs normally asks the user to confirm that it is ok |
| 1448 | to terminate them. Each process has a query flag which, if | 1447 | to terminate them. Each process has a query flag which, if |
| 1449 | non-@code{nil}, says that Emacs should ask for confirmation before | 1448 | non-@code{nil}, says that Emacs should ask for confirmation before |