Function: set-process-filter
set-process-filter is a function defined in process.c.
Signature
(set-process-filter PROCESS FILTER)
Documentation
Give PROCESS the filter function FILTER; nil means default.
A value of t means stop accepting output from the process.
When a process has a non-default filter, its buffer is not used for output. Instead, each time it does output, the entire string of output is passed to the filter.
The filter gets two arguments: the process and the string of output.
The string argument is normally a multibyte string, except:
- if the process's input coding system is no-conversion or raw-text,
it is a unibyte string (the non-converted input).
Source Code
// Defined in /usr/src/emacs/src/process.c
{
CHECK_PROCESS (process);
struct Lisp_Process *p = XPROCESS (process);
/* Don't signal an error if the process's input file descriptor
is closed. This could make debugging Lisp more difficult,
for example when doing something like
(setq process (start-process ...))
(debug)
(set-process-filter process ...) */
if (NILP (filter))
filter = Qinternal_default_process_filter;
if (p->infd >= 0)
{
/* If filter WILL be t, stop reading output. */
if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
delete_read_fd (p->infd);
else if (/* If filter WAS t, then resume reading output. */
EQ (p->filter, Qt)
/* Network or serial process not stopped: */
&& !EQ (p->command, Qt))
add_process_read_fd (p->infd);
}
pset_filter (p, filter);
if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p))
pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
setup_process_coding_systems (process);
return filter;
}