[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/async-dns 9755b75 4/4: Allow setting the filter ma
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] feature/async-dns 9755b75 4/4: Allow setting the filter masks later |
Date: |
Tue, 16 Feb 2016 02:38:20 +0000 |
branch: feature/async-dns
commit 9755b75300b7c451bc79984eed2e346ce0a4ffb5
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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.
---
src/process.c | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/process.c b/src/process.c
index 02e19c3..b4a2de9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -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