Commit 1619761d authored by Karl Heuer's avatar Karl Heuer

(get_process): Allow arg to be a buffer object.

parent fc9183db
......@@ -543,24 +543,34 @@ static Lisp_Object
get_process (name)
register Lisp_Object name;
{
register Lisp_Object proc;
if (NILP (name))
proc = Fget_buffer_process (Fcurrent_buffer ());
register Lisp_Object proc, obj;
if (STRINGP (name))
{
obj = Fget_process (name);
if (NILP (obj))
obj = Fget_buffer (name);
if (NILP (obj))
error ("Process %s does not exist", XSTRING (name)->data);
}
else if (NILP (name))
obj = Fcurrent_buffer ();
else
obj = name;
/* Now obj should be either a buffer object or a process object.
*/
if (BUFFERP (obj))
{
proc = Fget_process (name);
proc = Fget_buffer_process (obj);
if (NILP (proc))
proc = Fget_buffer_process (Fget_buffer (name));
error ("Buffer %s has no process", XSTRING (XBUFFER (obj)->name)->data);
}
if (!NILP (proc))
return proc;
if (NILP (name))
error ("Current buffer has no process");
else
error ("Process %s does not exist", XSTRING (name)->data);
/* NOTREACHED */
{
CHECK_PROCESS (obj, 0);
proc = obj;
}
return proc;
}
DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment