Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port get-process #256

merged 6 commits into from Jul 22, 2017
Changes from all commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.


Just for now

@@ -1149,6 +1149,7 @@ extern "C" {
pub static Qfont_object: Lisp_Object;
pub static lispsym: Lisp_Symbol;
pub static Vbuffer_alist: Lisp_Object;
pub static Vprocess_alist: Lisp_Object;

pub fn Fcons(car: Lisp_Object, cdr: Lisp_Object) -> Lisp_Object;
pub fn Fcurrent_buffer() -> Lisp_Object;
@@ -40,6 +40,7 @@ mod multibyte;
mod buffers;
mod windows;
mod interactive;
mod process;

#[cfg(all(not(test), target_os = "macos"))]
use alloc_unexecmacosx::OsxUnexecAlloc;
@@ -120,6 +121,7 @@ pub use crypto::sha512_buffer;

// Used in process.c
pub use str2sig::str2sig;
pub use process::Fget_process;

// Used in character.c
pub use multibyte::char_resolve_modifier_mask;
@@ -148,6 +150,7 @@ pub extern "C" fn rust_init_syms() {
@@ -179,7 +179,7 @@ fn assq(key: LispObject, list: LispObject) -> LispObject {
/// Equality is defined by TESTFN is non-nil or by `equal' if nil.
#[lisp_fn(min = "2")]
fn assoc(key: LispObject, list: LispObject, testfn: LispObject) -> LispObject {
pub fn assoc(key: LispObject, list: LispObject, testfn: LispObject) -> LispObject {
for tail in list.iter_tails() {
let item =;
if let Some(item_cons) = item.as_cons() {
@@ -0,0 +1,21 @@
//! Functions operating on process.

use remacs_macros::lisp_fn;
use remacs_sys::Vprocess_alist;
use lisp::LispObject;
use lists::{assoc, cdr};

/// Return the process named NAME, or nil if there is none.
fn get_process(name: LispObject) -> LispObject {
if name.is_process() {
} else {
LispObject::from_raw(unsafe { Vprocess_alist }),
@@ -270,7 +270,7 @@ static Lisp_Object chan_process[FD_SETSIZE];
static void wait_for_socket_fds (Lisp_Object, char const *);

/* Alist of elements (NAME . PROCESS). */
static Lisp_Object Vprocess_alist;
Lisp_Object Vprocess_alist;

/* Buffered-ahead input char from process, indexed by channel.
-1 means empty (no char is buffered).
@@ -929,24 +929,13 @@ free_dns_request (Lisp_Object proc)

DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
doc: /* Return t if OBJECT is a process. */)
(Lisp_Object object)
return PROCESSP (object) ? Qt : Qnil;

DEFUN ("get-process", Fget_process, Sget_process, 1, 1, 0,
doc: /* Return the process named NAME, or nil if there is none. */)
(register Lisp_Object name)
if (PROCESSP (name))
return name;
return Fcdr (Fassoc (name, Vprocess_alist, Qnil));

/* This is how commands for the user decode process arguments. It
accepts a process, a process name, a buffer, a buffer name, or nil.
Buffers denote the first process in the buffer, and nil denotes the
@@ -7918,7 +7907,6 @@ The variable takes effect when `start-process' is called. */);
Vprocess_adaptive_read_buffering = Qt;

defsubr (&Sprocessp);
defsubr (&Sget_process);
defsubr (&Sdelete_process);
defsubr (&Sprocess_status);
defsubr (&Sprocess_exit_status);
ProTip! Use n and p to navigate between commits in a pull request.