diff options
| author | Kenichi Handa | 2007-02-27 11:03:46 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-02-27 11:03:46 +0000 |
| commit | 1b234f649074701e4cfd3bbd23508015282daf33 (patch) | |
| tree | f7655cd3807c68548721bbbfc292084122e1f63e | |
| parent | a73d7753f965734247be482efa125da5235996da (diff) | |
| download | emacs-1b234f649074701e4cfd3bbd23508015282daf33.tar.gz emacs-1b234f649074701e4cfd3bbd23508015282daf33.zip | |
Cancel the change done by sync with HEAD.
| -rw-r--r-- | src/process.c | 91 |
1 files changed, 12 insertions, 79 deletions
diff --git a/src/process.c b/src/process.c index 27dc9f19e56..4611ce2c05c 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5641,83 +5641,6 @@ send_process (proc, buf, len, object) | |||
| 5641 | UNGCPRO; | 5641 | UNGCPRO; |
| 5642 | } | 5642 | } |
| 5643 | 5643 | ||
| 5644 | static Lisp_Object | ||
| 5645 | send_process_object_unwind (buf) | ||
| 5646 | Lisp_Object buf; | ||
| 5647 | { | ||
| 5648 | Lisp_Object tembuf; | ||
| 5649 | |||
| 5650 | if (XBUFFER (buf) == current_buffer) | ||
| 5651 | return Qnil; | ||
| 5652 | tembuf = Fcurrent_buffer (); | ||
| 5653 | Fset_buffer (buf); | ||
| 5654 | Fkill_buffer (tembuf); | ||
| 5655 | return Qnil; | ||
| 5656 | } | ||
| 5657 | |||
| 5658 | /* Send current contents of region between START and END to PROC. | ||
| 5659 | If START is a string, send it instead. | ||
| 5660 | This function can evaluate Lisp code and can garbage collect. */ | ||
| 5661 | |||
| 5662 | static void | ||
| 5663 | send_process_object (proc, start, end) | ||
| 5664 | Lisp_Object proc, start, end; | ||
| 5665 | { | ||
| 5666 | int count = SPECPDL_INDEX (); | ||
| 5667 | Lisp_Object object = STRINGP (start) ? start : Fcurrent_buffer (); | ||
| 5668 | struct buffer *given_buffer = current_buffer; | ||
| 5669 | unsigned char *buf; | ||
| 5670 | int len; | ||
| 5671 | |||
| 5672 | record_unwind_protect (send_process_object_unwind, Fcurrent_buffer ()); | ||
| 5673 | |||
| 5674 | if (STRINGP (object) ? STRING_MULTIBYTE (object) | ||
| 5675 | : ! NILP (XBUFFER (object)->enable_multibyte_characters)) | ||
| 5676 | { | ||
| 5677 | struct Lisp_Process *p = XPROCESS (proc); | ||
| 5678 | struct coding_system *coding = proc_encode_coding_system[XINT (p->outfd)]; | ||
| 5679 | |||
| 5680 | if (! EQ (coding->symbol, p->encode_coding_system)) | ||
| 5681 | /* The coding system for encoding was changed to raw-text | ||
| 5682 | because we sent a unibyte text previously. Now we are | ||
| 5683 | sending a multibyte text, thus we must encode it by the | ||
| 5684 | original coding system specified for the current process. */ | ||
| 5685 | setup_coding_system (p->encode_coding_system, coding); | ||
| 5686 | if (! NILP (coding->pre_write_conversion)) | ||
| 5687 | { | ||
| 5688 | struct gcpro gcpro1, gcpro2; | ||
| 5689 | |||
| 5690 | GCPRO2 (proc, object); | ||
| 5691 | call2 (coding->pre_write_conversion, start, end); | ||
| 5692 | UNGCPRO; | ||
| 5693 | if (given_buffer != current_buffer) | ||
| 5694 | { | ||
| 5695 | start = make_number (BEGV), end = make_number (ZV); | ||
| 5696 | object = Fcurrent_buffer (); | ||
| 5697 | } | ||
| 5698 | } | ||
| 5699 | } | ||
| 5700 | |||
| 5701 | if (BUFFERP (object)) | ||
| 5702 | { | ||
| 5703 | EMACS_INT start_byte; | ||
| 5704 | |||
| 5705 | if (XINT (start) < GPT && XINT (end) > GPT) | ||
| 5706 | move_gap (XINT (end)); | ||
| 5707 | start_byte = CHAR_TO_BYTE (XINT (start)); | ||
| 5708 | buf = BYTE_POS_ADDR (start_byte); | ||
| 5709 | len = CHAR_TO_BYTE (XINT (end)) - start_byte; | ||
| 5710 | } | ||
| 5711 | else | ||
| 5712 | { | ||
| 5713 | buf = SDATA (object); | ||
| 5714 | len = SBYTES (object); | ||
| 5715 | } | ||
| 5716 | send_process (proc, buf, len, object); | ||
| 5717 | |||
| 5718 | unbind_to (count, Qnil); | ||
| 5719 | } | ||
| 5720 | |||
| 5721 | DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, | 5644 | DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, |
| 5722 | 3, 3, 0, | 5645 | 3, 3, 0, |
| 5723 | doc: /* Send current contents of region as input to PROCESS. | 5646 | doc: /* Send current contents of region as input to PROCESS. |
| @@ -5731,10 +5654,19 @@ Output from processes can arrive in between bunches. */) | |||
| 5731 | Lisp_Object process, start, end; | 5654 | Lisp_Object process, start, end; |
| 5732 | { | 5655 | { |
| 5733 | Lisp_Object proc; | 5656 | Lisp_Object proc; |
| 5657 | int start1, end1; | ||
| 5734 | 5658 | ||
| 5735 | proc = get_process (process); | 5659 | proc = get_process (process); |
| 5736 | validate_region (&start, &end); | 5660 | validate_region (&start, &end); |
| 5737 | send_process_object (proc, start, end); | 5661 | |
| 5662 | if (XINT (start) < GPT && XINT (end) > GPT) | ||
| 5663 | move_gap (XINT (start)); | ||
| 5664 | |||
| 5665 | start1 = CHAR_TO_BYTE (XINT (start)); | ||
| 5666 | end1 = CHAR_TO_BYTE (XINT (end)); | ||
| 5667 | send_process (proc, BYTE_POS_ADDR (start1), end1 - start1, | ||
| 5668 | Fcurrent_buffer ()); | ||
| 5669 | |||
| 5738 | return Qnil; | 5670 | return Qnil; |
| 5739 | } | 5671 | } |
| 5740 | 5672 | ||
| @@ -5752,7 +5684,8 @@ Output from processes can arrive in between bunches. */) | |||
| 5752 | Lisp_Object proc; | 5684 | Lisp_Object proc; |
| 5753 | CHECK_STRING (string); | 5685 | CHECK_STRING (string); |
| 5754 | proc = get_process (process); | 5686 | proc = get_process (process); |
| 5755 | send_process_object (proc, string, Qnil); | 5687 | send_process (proc, SDATA (string), |
| 5688 | SBYTES (string), string); | ||
| 5756 | return Qnil; | 5689 | return Qnil; |
| 5757 | } | 5690 | } |
| 5758 | 5691 | ||