Commit 9755b753 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Allow setting the filter masks later

* src/process.c (Fset_process_filter): Don't set the socket
masks here, because we may not have a socket yet.
(set_process_filter_masks): New function.
(connect_network_socket): Set the filter masks here.
parent 1bbffcd9
......@@ -1034,6 +1034,23 @@ DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
return XPROCESS (process)->mark;
}
static void
set_process_filter_masks (struct Lisp_Process *p)
{
if (EQ (p->filter, Qt) && !EQ (p->status, Qlisten))
{
FD_CLR (p->infd, &input_wait_mask);
FD_CLR (p->infd, &non_keyboard_wait_mask);
}
else if (EQ (p->filter, Qt)
/* Network or serial process not stopped: */
&& !EQ (p->command, Qt))
{
FD_SET (p->infd, &input_wait_mask);
FD_SET (p->infd, &non_keyboard_wait_mask);
}
}
DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
2, 2, 0,
doc: /* Give PROCESS the filter function FILTER; nil means default.
......@@ -1069,23 +1086,11 @@ The string argument is normally a multibyte string, except:
if (NILP (filter))
filter = Qinternal_default_process_filter;
pset_filter (p, filter);
if (p->infd >= 0)
{
if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
{
FD_CLR (p->infd, &input_wait_mask);
FD_CLR (p->infd, &non_keyboard_wait_mask);
}
else if (EQ (p->filter, Qt)
/* Network or serial process not stopped: */
&& !EQ (p->command, Qt))
{
FD_SET (p->infd, &input_wait_mask);
FD_SET (p->infd, &non_keyboard_wait_mask);
}
}
set_process_filter_masks (p);
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);
......@@ -3342,6 +3347,9 @@ void connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses)
if (inch > max_process_desc)
max_process_desc = inch;
/* Set up the masks based on the process filter. */
set_process_filter_masks (p);
setup_process_coding_systems (proc);
#ifdef HAVE_GNUTLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment