diff options
| author | Lars Ingebrigtsen | 2016-02-16 13:37:33 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-16 13:37:33 +1100 |
| commit | 9755b75300b7c451bc79984eed2e346ce0a4ffb5 (patch) | |
| tree | 9e0612c3375582f2db20975e88e0365567c8b376 /src | |
| parent | 1bbffcd9d70793ede66d74d6cccb5f6734893e36 (diff) | |
| download | emacs-9755b75300b7c451bc79984eed2e346ce0a4ffb5.tar.gz emacs-9755b75300b7c451bc79984eed2e346ce0a4ffb5.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/process.c b/src/process.c index 02e19c3a84e..b4a2de98e12 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1034,6 +1034,23 @@ DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, | |||
| 1034 | return XPROCESS (process)->mark; | 1034 | return XPROCESS (process)->mark; |
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| 1037 | static void | ||
| 1038 | set_process_filter_masks (struct Lisp_Process *p) | ||
| 1039 | { | ||
| 1040 | if (EQ (p->filter, Qt) && !EQ (p->status, Qlisten)) | ||
| 1041 | { | ||
| 1042 | FD_CLR (p->infd, &input_wait_mask); | ||
| 1043 | FD_CLR (p->infd, &non_keyboard_wait_mask); | ||
| 1044 | } | ||
| 1045 | else if (EQ (p->filter, Qt) | ||
| 1046 | /* Network or serial process not stopped: */ | ||
| 1047 | && !EQ (p->command, Qt)) | ||
| 1048 | { | ||
| 1049 | FD_SET (p->infd, &input_wait_mask); | ||
| 1050 | FD_SET (p->infd, &non_keyboard_wait_mask); | ||
| 1051 | } | ||
| 1052 | } | ||
| 1053 | |||
| 1037 | DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, | 1054 | DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, |
| 1038 | 2, 2, 0, | 1055 | 2, 2, 0, |
| 1039 | doc: /* Give PROCESS the filter function FILTER; nil means default. | 1056 | doc: /* Give PROCESS the filter function FILTER; nil means default. |
| @@ -1069,23 +1086,11 @@ The string argument is normally a multibyte string, except: | |||
| 1069 | if (NILP (filter)) | 1086 | if (NILP (filter)) |
| 1070 | filter = Qinternal_default_process_filter; | 1087 | filter = Qinternal_default_process_filter; |
| 1071 | 1088 | ||
| 1089 | pset_filter (p, filter); | ||
| 1090 | |||
| 1072 | if (p->infd >= 0) | 1091 | if (p->infd >= 0) |
| 1073 | { | 1092 | set_process_filter_masks (p); |
| 1074 | if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) | ||
| 1075 | { | ||
| 1076 | FD_CLR (p->infd, &input_wait_mask); | ||
| 1077 | FD_CLR (p->infd, &non_keyboard_wait_mask); | ||
| 1078 | } | ||
| 1079 | else if (EQ (p->filter, Qt) | ||
| 1080 | /* Network or serial process not stopped: */ | ||
| 1081 | && !EQ (p->command, Qt)) | ||
| 1082 | { | ||
| 1083 | FD_SET (p->infd, &input_wait_mask); | ||
| 1084 | FD_SET (p->infd, &non_keyboard_wait_mask); | ||
| 1085 | } | ||
| 1086 | } | ||
| 1087 | 1093 | ||
| 1088 | pset_filter (p, filter); | ||
| 1089 | if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) | 1094 | if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) |
| 1090 | pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); | 1095 | pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); |
| 1091 | setup_process_coding_systems (process); | 1096 | setup_process_coding_systems (process); |
| @@ -3342,6 +3347,9 @@ void connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses) | |||
| 3342 | if (inch > max_process_desc) | 3347 | if (inch > max_process_desc) |
| 3343 | max_process_desc = inch; | 3348 | max_process_desc = inch; |
| 3344 | 3349 | ||
| 3350 | /* Set up the masks based on the process filter. */ | ||
| 3351 | set_process_filter_masks (p); | ||
| 3352 | |||
| 3345 | setup_process_coding_systems (proc); | 3353 | setup_process_coding_systems (proc); |
| 3346 | 3354 | ||
| 3347 | #ifdef HAVE_GNUTLS | 3355 | #ifdef HAVE_GNUTLS |