diff options
| author | Eli Zaretskii | 2016-12-05 20:59:11 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-12-05 20:59:11 +0200 |
| commit | e4deba098e0281538a0e7b04d849989f17e5bcc7 (patch) | |
| tree | 597ec86397a68d6a73f8ce948ac28abc19b335f6 /src | |
| parent | de4624c99ea5bbe38ad5aff7b6461cc5c740d0be (diff) | |
| download | emacs-e4deba098e0281538a0e7b04d849989f17e5bcc7.tar.gz emacs-e4deba098e0281538a0e7b04d849989f17e5bcc7.zip | |
Fix merged code in process.c and eval.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.c | 31 | ||||
| -rw-r--r-- | src/process.c | 13 |
2 files changed, 33 insertions, 11 deletions
diff --git a/src/eval.c b/src/eval.c index c08f93aee0c..4405b8bb738 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -3323,15 +3323,24 @@ rebind_for_thread_switch (void) | |||
| 3323 | if (bind->kind >= SPECPDL_LET) | 3323 | if (bind->kind >= SPECPDL_LET) |
| 3324 | { | 3324 | { |
| 3325 | Lisp_Object value = specpdl_saved_value (bind); | 3325 | Lisp_Object value = specpdl_saved_value (bind); |
| 3326 | 3326 | Lisp_Object sym = specpdl_symbol (bind); | |
| 3327 | bool was_trapped = | ||
| 3328 | SYMBOLP (sym) | ||
| 3329 | && XSYMBOL (sym)->trapped_write == SYMBOL_TRAPPED_WRITE; | ||
| 3330 | /* FIXME: This is not clean, and if do_specbind signals an | ||
| 3331 | error, the symbol will be left untrapped. */ | ||
| 3332 | if (was_trapped) | ||
| 3333 | XSYMBOL (sym)->trapped_write = SYMBOL_UNTRAPPED_WRITE; | ||
| 3327 | bind->let.saved_value = Qnil; | 3334 | bind->let.saved_value = Qnil; |
| 3328 | do_specbind (XSYMBOL (specpdl_symbol (bind)), bind, value); | 3335 | do_specbind (XSYMBOL (sym, bind, value, true); |
| 3336 | if (was_trapped) | ||
| 3337 | XSYMBOL (sym)->trapped_write = SYMBOL_TRAPPED_WRITE; | ||
| 3329 | } | 3338 | } |
| 3330 | } | 3339 | } |
| 3331 | } | 3340 | } |
| 3332 | 3341 | ||
| 3333 | static void | 3342 | static void |
| 3334 | do_one_unbind (union specbinding *this_binding, int unwinding) | 3343 | do_one_unbind (union specbinding *this_binding, bool unwinding) |
| 3335 | { | 3344 | { |
| 3336 | eassert (unwinding || this_binding->kind >= SPECPDL_LET); | 3345 | eassert (unwinding || this_binding->kind >= SPECPDL_LET); |
| 3337 | switch (this_binding->kind) | 3346 | switch (this_binding->kind) |
| @@ -3458,7 +3467,7 @@ unbind_to (ptrdiff_t count, Lisp_Object value) | |||
| 3458 | union specbinding this_binding; | 3467 | union specbinding this_binding; |
| 3459 | this_binding = *--specpdl_ptr; | 3468 | this_binding = *--specpdl_ptr; |
| 3460 | 3469 | ||
| 3461 | do_one_unbind (&this_binding, 1); | 3470 | do_one_unbind (&this_binding, true); |
| 3462 | } | 3471 | } |
| 3463 | 3472 | ||
| 3464 | if (NILP (Vquit_flag) && !NILP (quitf)) | 3473 | if (NILP (Vquit_flag) && !NILP (quitf)) |
| @@ -3476,8 +3485,18 @@ unbind_for_thread_switch (struct thread_state *thr) | |||
| 3476 | { | 3485 | { |
| 3477 | if ((--bind)->kind >= SPECPDL_LET) | 3486 | if ((--bind)->kind >= SPECPDL_LET) |
| 3478 | { | 3487 | { |
| 3479 | bind->let.saved_value = find_symbol_value (specpdl_symbol (bind)); | 3488 | Lisp_Object sym = specpdl_symbol (bind); |
| 3480 | do_one_unbind (bind, 0); | 3489 | bool was_trapped = |
| 3490 | SYMBOLP (sym) | ||
| 3491 | && XSYMBOL (sym)->trapped_write == SYMBOL_TRAPPED_WRITE; | ||
| 3492 | bind->let.saved_value = find_symbol_value (sym); | ||
| 3493 | /* FIXME: This is not clean, and if do_one_unbind signals an | ||
| 3494 | error, the symbol will be left untrapped. */ | ||
| 3495 | if (was_trapped) | ||
| 3496 | XSYMBOL (sym)->trapped_write = SYMBOL_UNTRAPPED_WRITE; | ||
| 3497 | do_one_unbind (bind, false); | ||
| 3498 | if (was_trapped) | ||
| 3499 | XSYMBOL (sym)->trapped_write = SYMBOL_TRAPPED_WRITE; | ||
| 3481 | } | 3500 | } |
| 3482 | } | 3501 | } |
| 3483 | } | 3502 | } |
diff --git a/src/process.c b/src/process.c index e538c86fcf5..7f2a071e67b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1321,7 +1321,8 @@ See `set-process-sentinel' for more info on sentinels. */) | |||
| 1321 | 1321 | ||
| 1322 | DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread, | 1322 | DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread, |
| 1323 | 2, 2, 0, | 1323 | 2, 2, 0, |
| 1324 | doc: /* FIXME */) | 1324 | doc: /* Set the locking thread of PROCESS to be THREAD. |
| 1325 | If THREAD is nil, the process is unlocked. */) | ||
| 1325 | (Lisp_Object process, Lisp_Object thread) | 1326 | (Lisp_Object process, Lisp_Object thread) |
| 1326 | { | 1327 | { |
| 1327 | struct Lisp_Process *proc; | 1328 | struct Lisp_Process *proc; |
| @@ -1348,7 +1349,8 @@ DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread, | |||
| 1348 | 1349 | ||
| 1349 | DEFUN ("process-thread", Fprocess_thread, Sprocess_thread, | 1350 | DEFUN ("process-thread", Fprocess_thread, Sprocess_thread, |
| 1350 | 1, 1, 0, | 1351 | 1, 1, 0, |
| 1351 | doc: /* FIXME */) | 1352 | doc: /* Ret the locking thread of PROCESS. |
| 1353 | If PROCESS is unlocked, this function returns nil. */) | ||
| 1352 | (Lisp_Object process) | 1354 | (Lisp_Object process) |
| 1353 | { | 1355 | { |
| 1354 | CHECK_PROCESS (process); | 1356 | CHECK_PROCESS (process); |
| @@ -4573,7 +4575,8 @@ is nil, from any process) before the timeout expired. */) | |||
| 4573 | /* Can't wait for a process that is dedicated to a different | 4575 | /* Can't wait for a process that is dedicated to a different |
| 4574 | thread. */ | 4576 | thread. */ |
| 4575 | if (!EQ (procp->thread, Qnil) && !EQ (procp->thread, Fcurrent_thread ())) | 4577 | if (!EQ (procp->thread, Qnil) && !EQ (procp->thread, Fcurrent_thread ())) |
| 4576 | error ("FIXME"); | 4578 | error ("Attempt to accept output from process %s locked to thread %s", |
| 4579 | SDATA (procp->name), SDATA (XTHREAD (procp->thread)->name)); | ||
| 4577 | } | 4580 | } |
| 4578 | else | 4581 | else |
| 4579 | just_this_one = Qnil; | 4582 | just_this_one = Qnil; |
| @@ -5727,7 +5730,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5727 | 5730 | ||
| 5728 | if (0 <= p->infd && !EQ (p->filter, Qt) | 5731 | if (0 <= p->infd && !EQ (p->filter, Qt) |
| 5729 | && !EQ (p->command, Qt)) | 5732 | && !EQ (p->command, Qt)) |
| 5730 | delete_read_fd (p->infd); | 5733 | add_read_fd (p->infd); |
| 5731 | } | 5734 | } |
| 5732 | } | 5735 | } |
| 5733 | } /* End for each file descriptor. */ | 5736 | } /* End for each file descriptor. */ |
| @@ -7660,7 +7663,7 @@ add_keyboard_wait_descriptor (int desc) | |||
| 7660 | { | 7663 | { |
| 7661 | #ifdef subprocesses /* Actually means "not MSDOS". */ | 7664 | #ifdef subprocesses /* Actually means "not MSDOS". */ |
| 7662 | eassert (desc >= 0 && desc < FD_SETSIZE); | 7665 | eassert (desc >= 0 && desc < FD_SETSIZE); |
| 7663 | fd_callback_info[desc].flags |= FOR_READ | KEYBOARD_FD; | 7666 | fd_callback_info[desc].flags |= (FOR_READ | KEYBOARD_FD); |
| 7664 | if (desc > max_desc) | 7667 | if (desc > max_desc) |
| 7665 | max_desc = desc; | 7668 | max_desc = desc; |
| 7666 | #endif | 7669 | #endif |