diff options
author | Karl Heuer <kwzh@gnu.org> | 1994-03-12 03:13:20 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1994-03-12 03:13:20 +0000 |
commit | 1619761daf391c9437c34678cba282f95710a04f (patch) | |
tree | 33ad7b547e70ed9f663d8fc038e67a345ecd1190 | |
parent | fc9183db8edc7169091b63bdc1691a11f2ee2982 (diff) | |
download | emacs-1619761daf391c9437c34678cba282f95710a04f.tar.gz |
(get_process): Allow arg to be a buffer object.
-rw-r--r-- | src/process.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/process.c b/src/process.c index 316e02296af..1fdeac3d293 100644 --- a/src/process.c +++ b/src/process.c @@ -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, |