if (bind->kind >= SPECPDL_LET)
{
Lisp_Object value = specpdl_saved_value (bind);
-
+ Lisp_Object sym = specpdl_symbol (bind);
+ bool was_trapped =
+ SYMBOLP (sym)
+ && XSYMBOL (sym)->trapped_write == SYMBOL_TRAPPED_WRITE;
+ /* FIXME: This is not clean, and if do_specbind signals an
+ error, the symbol will be left untrapped. */
+ if (was_trapped)
+ XSYMBOL (sym)->trapped_write = SYMBOL_UNTRAPPED_WRITE;
bind->let.saved_value = Qnil;
- do_specbind (XSYMBOL (specpdl_symbol (bind)), bind, value);
+ do_specbind (XSYMBOL (sym, bind, value, true);
+ if (was_trapped)
+ XSYMBOL (sym)->trapped_write = SYMBOL_TRAPPED_WRITE;
}
}
}
static void
-do_one_unbind (union specbinding *this_binding, int unwinding)
+do_one_unbind (union specbinding *this_binding, bool unwinding)
{
eassert (unwinding || this_binding->kind >= SPECPDL_LET);
switch (this_binding->kind)
union specbinding this_binding;
this_binding = *--specpdl_ptr;
- do_one_unbind (&this_binding, 1);
+ do_one_unbind (&this_binding, true);
}
if (NILP (Vquit_flag) && !NILP (quitf))
{
if ((--bind)->kind >= SPECPDL_LET)
{
- bind->let.saved_value = find_symbol_value (specpdl_symbol (bind));
- do_one_unbind (bind, 0);
+ Lisp_Object sym = specpdl_symbol (bind);
+ bool was_trapped =
+ SYMBOLP (sym)
+ && XSYMBOL (sym)->trapped_write == SYMBOL_TRAPPED_WRITE;
+ bind->let.saved_value = find_symbol_value (sym);
+ /* FIXME: This is not clean, and if do_one_unbind signals an
+ error, the symbol will be left untrapped. */
+ if (was_trapped)
+ XSYMBOL (sym)->trapped_write = SYMBOL_UNTRAPPED_WRITE;
+ do_one_unbind (bind, false);
+ if (was_trapped)
+ XSYMBOL (sym)->trapped_write = SYMBOL_TRAPPED_WRITE;
}
}
}
DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread,
2, 2, 0,
- doc: /* FIXME */)
+ doc: /* Set the locking thread of PROCESS to be THREAD.
+If THREAD is nil, the process is unlocked. */)
(Lisp_Object process, Lisp_Object thread)
{
struct Lisp_Process *proc;
DEFUN ("process-thread", Fprocess_thread, Sprocess_thread,
1, 1, 0,
- doc: /* FIXME */)
+ doc: /* Ret the locking thread of PROCESS.
+If PROCESS is unlocked, this function returns nil. */)
(Lisp_Object process)
{
CHECK_PROCESS (process);
/* Can't wait for a process that is dedicated to a different
thread. */
if (!EQ (procp->thread, Qnil) && !EQ (procp->thread, Fcurrent_thread ()))
- error ("FIXME");
+ error ("Attempt to accept output from process %s locked to thread %s",
+ SDATA (procp->name), SDATA (XTHREAD (procp->thread)->name));
}
else
just_this_one = Qnil;
if (0 <= p->infd && !EQ (p->filter, Qt)
&& !EQ (p->command, Qt))
- delete_read_fd (p->infd);
+ add_read_fd (p->infd);
}
}
} /* End for each file descriptor. */
{
#ifdef subprocesses /* Actually means "not MSDOS". */
eassert (desc >= 0 && desc < FD_SETSIZE);
- fd_callback_info[desc].flags |= FOR_READ | KEYBOARD_FD;
+ fd_callback_info[desc].flags |= (FOR_READ | KEYBOARD_FD);
if (desc > max_desc)
max_desc = desc;
#endif