Allow creating a pipe process without a buffer

Previously, even passing :buffer nil to make-pipe-process would
create a buffer.  Now, if you explicitly call (make-pipe-process
:buffer nil), it will create a pipe process without a buffer,
just like all the other process creation functions.

* src/process.c (Fmake_pipe_process): Check for explicit :buffer
nil and don't make a buffer. (bug#79596)
* doc/lispref/processes.texi (Asynchronous Processes): Update.
* test/src/process-tests.el
(process-test-make-pipe-process-no-buffer): Add test.
This commit is contained in:
Spencer Baugh 2025-10-07 14:41:20 -04:00 committed by Eli Zaretskii
parent dc2650faa9
commit 443af6fe1d
3 changed files with 19 additions and 6 deletions

View file

@ -842,7 +842,8 @@ Use the string @var{name} as the process name. As with
@code{make-process}, it is modified if necessary to make it unique.
@item :buffer @var{buffer}
Use @var{buffer} as the process buffer.
Use @var{buffer} as the process buffer. If the value is @code{nil},
the subprocess is not associated with any buffer.
@item :coding @var{coding}
If @var{coding} is a symbol, it specifies the coding system to be

View file

@ -2414,7 +2414,8 @@ arguments are defined:
:buffer BUFFER -- BUFFER is the buffer (or buffer-name) to associate
with the process. Process output goes at the end of that buffer,
unless you specify a filter function to handle the output. If BUFFER
is not given, the value of NAME is used.
is not given, the value of NAME is used. BUFFER may be also nil, meaning
that this process is not associated with any buffer.
:coding CODING -- If CODING is a symbol, it specifies the coding
system used for both reading and writing for this process. If CODING
@ -2479,10 +2480,15 @@ usage: (make-pipe-process &rest ARGS) */)
if (inchannel > max_desc)
max_desc = inchannel;
buffer = plist_get (contact, QCbuffer);
if (NILP (buffer))
buffer = name;
buffer = Fget_buffer_create (buffer, Qnil);
{
Lisp_Object buffer_member = plist_member (contact, QCbuffer);
if (NILP (buffer_member))
buffer = name;
else
buffer = XCAR (XCDR (buffer_member));
}
if (!NILP (buffer))
buffer = Fget_buffer_create (buffer, Qnil);
pset_buffer (p, buffer);
pset_childp (p, contact);

View file

@ -1053,5 +1053,11 @@ Return nil if FILENAME doesn't exist."
(should (integerp (num-processors)))
(should (< 0 (num-processors))))
(ert-deftest process-test-make-pipe-process-no-buffer ()
"Test that a pipe process can be created without a buffer."
(should (process-buffer (make-pipe-process :name "test")))
(should (process-buffer (make-pipe-process :name "test" :buffer "test")))
(should-not (process-buffer (make-pipe-process :name "test" :buffer nil))))
(provide 'process-tests)
;;; process-tests.el ends here