summaryrefslogtreecommitdiff
path: root/devdocs/elisp/input-to-processes.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/input-to-processes.html')
-rw-r--r--devdocs/elisp/input-to-processes.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/devdocs/elisp/input-to-processes.html b/devdocs/elisp/input-to-processes.html
new file mode 100644
index 00000000..da3e29ad
--- /dev/null
+++ b/devdocs/elisp/input-to-processes.html
@@ -0,0 +1,24 @@
+ <h3 class="section">Sending Input to Processes</h3> <p>Asynchronous subprocesses receive input when it is sent to them by Emacs, which is done with the functions in this section. You must specify the process to send input to, and the input data to send. If the subprocess runs a program, the data appears on the standard input of that program; for connections, the data is sent to the connected device or program. </p> <p>Some operating systems have limited space for buffered input in a pty. On these systems, Emacs sends an <acronym>EOF</acronym> periodically amidst the other characters, to force them through. For most programs, these <acronym>EOF</acronym>s do no harm. </p> <p>Subprocess input is normally encoded using a coding system before the subprocess receives it, much like text written into a file. You can use <code>set-process-coding-system</code> to specify which coding system to use (see <a href="process-information">Process Information</a>). Otherwise, the coding system comes from <code>coding-system-for-write</code>, if that is non-<code>nil</code>; or else from the defaulting mechanism (see <a href="default-coding-systems">Default Coding Systems</a>). </p> <p>Sometimes the system is unable to accept input for that process, because the input buffer is full. When this happens, the send functions wait a short while, accepting output from subprocesses, and then try again. This gives the subprocess a chance to read more of its pending input and make space in the buffer. It also allows filters (including the one currently running), sentinels and timers to run—so take account of that in writing your code. </p> <p>In these functions, the <var>process</var> argument can be a process or the name of a process, or a buffer or buffer name (which stands for a process via <code>get-buffer-process</code>). <code>nil</code> means the current buffer’s process. </p> <dl> <dt id="process-send-string">Function: <strong>process-send-string</strong> <em>process string</em>
+</dt> <dd>
+<p>This function sends <var>process</var> the contents of <var>string</var> as standard input. It returns <code>nil</code>. For example, to make a Shell buffer list files: </p> <div class="example"> <pre class="example">(process-send-string "shell&lt;1&gt;" "ls\n")
+ ⇒ nil
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="process-send-region">Function: <strong>process-send-region</strong> <em>process start end</em>
+</dt> <dd>
+<p>This function sends the text in the region defined by <var>start</var> and <var>end</var> as standard input to <var>process</var>. </p> <p>An error is signaled unless both <var>start</var> and <var>end</var> are integers or markers that indicate positions in the current buffer. (It is unimportant which number is larger.) </p>
+</dd>
+</dl> <dl> <dt id="process-send-eof">Function: <strong>process-send-eof</strong> <em>&amp;optional process</em>
+</dt> <dd>
+<p>This function makes <var>process</var> see an end-of-file in its input. The <acronym>EOF</acronym> comes after any text already sent to it. The function returns <var>process</var>. </p> <div class="example"> <pre class="example">(process-send-eof "shell")
+ ⇒ "shell"
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="process-running-child-p">Function: <strong>process-running-child-p</strong> <em>&amp;optional process</em>
+</dt> <dd><p>This function will tell you whether a <var>process</var>, which must not be a connection but a real subprocess, has given control of its terminal to a child process of its own. If this is true, the function returns the numeric ID of the foreground process group of <var>process</var>; it returns <code>nil</code> if Emacs can be certain that this is not so. The value is <code>t</code> if Emacs cannot tell whether this is true. This function signals an error if <var>process</var> is a network, serial, or pipe connection, or if the subprocess is not active. </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Input-to-Processes.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Input-to-Processes.html</a>
+ </p>
+</div>