GNU Emacs Lisp Reference Manual
A process can (and usually does) have an associated buffer, which is an ordinary Emacs buffer that is used for two purposes: storing the output from the process, and deciding when to kill the process. You can also use the buffer to identify a process to operate on, since in normal practice only one process is associated with any given buffer. Many applications of processes also use the buffer for editing input to be sent to the process, but this is not built into Emacs Lisp.
Unless the process has a filter function (see Filter Functions), its output is inserted in the associated buffer. The position to insert the output is determined by the process-mark, which is then updated to point to the end of the text just inserted. Usually, but not always, the process-mark is at the end of the buffer.
(process-buffer (get-process "shell"))
=> #
If process does not have a buffer, process-mark returns a marker that points nowhere.
Insertion of process output in a buffer uses this marker to decide where to insert, and updates it to point after the inserted text. That is why successive batches of output are inserted consecutively.
Filter functions normally should use this marker in the same fashion as is done by direct insertion of output in the buffer. A good example of a filter function that uses process-mark is found at the end of the following section.
When the user is expected to enter input in the process buffer for transmission to the process, the process marker is useful for distinguishing the new input from previous output.
nil, the process becomes associated with no buffer.(get-buffer-process "*shell*")
=> #
Killing the process's buffer deletes the process, which kills the subprocess with a SIGHUP signal (see Signals to Processes).