comparison src/process.c @ 6313:9a6531e6de5d

(get_process): Allow arg to be a buffer object.
author Karl Heuer <kwzh@gnu.org>
date Sat, 12 Mar 1994 03:13:20 +0000
parents 42914264b095
children 862304c3b015
comparison
equal deleted inserted replaced
6312:b55a8ce60e85 6313:9a6531e6de5d
541 541
542 static Lisp_Object 542 static Lisp_Object
543 get_process (name) 543 get_process (name)
544 register Lisp_Object name; 544 register Lisp_Object name;
545 { 545 {
546 register Lisp_Object proc; 546 register Lisp_Object proc, obj;
547 if (NILP (name)) 547 if (STRINGP (name))
548 proc = Fget_buffer_process (Fcurrent_buffer ()); 548 {
549 obj = Fget_process (name);
550 if (NILP (obj))
551 obj = Fget_buffer (name);
552 if (NILP (obj))
553 error ("Process %s does not exist", XSTRING (name)->data);
554 }
555 else if (NILP (name))
556 obj = Fcurrent_buffer ();
549 else 557 else
550 { 558 obj = name;
551 proc = Fget_process (name); 559
560 /* Now obj should be either a buffer object or a process object.
561 */
562 if (BUFFERP (obj))
563 {
564 proc = Fget_buffer_process (obj);
552 if (NILP (proc)) 565 if (NILP (proc))
553 proc = Fget_buffer_process (Fget_buffer (name)); 566 error ("Buffer %s has no process", XSTRING (XBUFFER (obj)->name)->data);
554 } 567 }
555
556 if (!NILP (proc))
557 return proc;
558
559 if (NILP (name))
560 error ("Current buffer has no process");
561 else 568 else
562 error ("Process %s does not exist", XSTRING (name)->data); 569 {
563 /* NOTREACHED */ 570 CHECK_PROCESS (obj, 0);
571 proc = obj;
572 }
573 return proc;
564 } 574 }
565 575
566 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0, 576 DEFUN ("delete-process", Fdelete_process, Sdelete_process, 1, 1, 0,
567 "Delete PROCESS: kill it and forget about it immediately.\n\ 577 "Delete PROCESS: kill it and forget about it immediately.\n\
568 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\ 578 PROCESS may be a process, a buffer, the name of a process or buffer, or\n\