remacs icon indicating copy to clipboard operation
remacs copied to clipboard

Port continue-process

Open brotzeit opened this issue 6 years ago • 0 comments

DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,
       doc: /* Continue process PROCESS.  May be process or name of one.
See function `interrupt-process' for more details on usage.
If PROCESS is a network or serial process, resume handling of incoming
traffic.  */)
  (Lisp_Object process, Lisp_Object current_group)
{
  if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process)
			     || PIPECONN_P (process)))
    {
      struct Lisp_Process *p;

      p = XPROCESS (process);
      if (EQ (p->command, Qt)
	  && p->infd >= 0
	  && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
	{
	  add_process_read_fd (p->infd);
#ifdef WINDOWSNT
	  if (fd_info[ p->infd ].flags & FILE_SERIAL)
	    PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR);
#else /* not WINDOWSNT */
	  tcflush (p->infd, TCIFLUSH);
#endif /* not WINDOWSNT */
	}
      pset_command (p, Qnil);
      return process;
    }
#ifdef SIGCONT
    process_send_signal (process, SIGCONT, current_group, 0);
#else
    error ("No SIGCONT support");
#endif
  return process;
}

From #1343:

/// Continue process PROCESS. May be process or name of one.
/// See function `interrupt-process' for more details on usage.
/// If PROCESS is a network or serial process, resume handling of incoming
/// traffic.
#[lisp_fn(min = "0")]
pub fn continue_process(process: LispObject, current_group: LispObject) -> LispObject {
    let mut p_ref: LispProcessRef = process.into();
    let process_type = p_ref.ptype();
    if process_type.eq(Qnetwork) || process_type.eq(Qserial) || process_type.eq(Qpipe) {
        unsafe {
            if p_ref.command.eq(Qt)
                && p_ref.infd >= 0
                && (!p_ref.filter.eq(Qt) || p_ref.status.eq(Qlisten))
            {
                add_process_read_fd(p_ref.infd);
                tcflush(p_ref.infd, libc::TCIFLUSH);
            }
        }
        p_ref.command = Qnil;
        return process;
    }

    unsafe {
        process_send_signal(process, libc::SIGCONT, current_group, false);
    }
    process
}

We have to add the missing macros: https://github.com/remacs/remacs/pull/1343#discussion_r255639295

brotzeit avatar Apr 20 '19 12:04 brotzeit