diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 59f6ddeb63b..12e43cda5a6 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -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 diff --git a/src/process.c b/src/process.c index 8ec420aaa2c..82b8829ba8c 100644 --- a/src/process.c +++ b/src/process.c @@ -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); diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 5f84d9acc6d..b8ceb931533 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -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