diff options
| author | Kenichi Handa | 2010-09-30 13:28:34 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-09-30 13:28:34 +0900 |
| commit | fcaf88782ba68e7c0618a663db51cf4a26cb3926 (patch) | |
| tree | 589ae64ef6f2e2acc260726235d0c98b29150c0a /src/process.c | |
| parent | 9fb7a510c91c6aad04d2d6ba8e8c0889d19e1d79 (diff) | |
| download | emacs-fcaf88782ba68e7c0618a663db51cf4a26cb3926.tar.gz emacs-fcaf88782ba68e7c0618a663db51cf4a26cb3926.zip | |
Complement a coding system for encoding arguments and input to a process.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 7adc114075e..3e2aa61ffe6 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1727,6 +1727,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1727 | val = XCDR (Vdefault_process_coding_system); | 1727 | val = XCDR (Vdefault_process_coding_system); |
| 1728 | } | 1728 | } |
| 1729 | XPROCESS (proc)->encode_coding_system = val; | 1729 | XPROCESS (proc)->encode_coding_system = val; |
| 1730 | /* Note: At this momemnt, the above coding system may leave | ||
| 1731 | text-conversion or eol-conversion unspecified. They will be | ||
| 1732 | decided after we read output from the process and decode it by | ||
| 1733 | some coding system, or just before we actually send a text to | ||
| 1734 | the process. */ | ||
| 1730 | } | 1735 | } |
| 1731 | 1736 | ||
| 1732 | 1737 | ||
| @@ -1769,6 +1774,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1769 | tem = Fsubstring (tem, make_number (2), Qnil); | 1774 | tem = Fsubstring (tem, make_number (2), Qnil); |
| 1770 | 1775 | ||
| 1771 | { | 1776 | { |
| 1777 | Lisp_Object arg_encoding = Qnil; | ||
| 1772 | struct gcpro gcpro1; | 1778 | struct gcpro gcpro1; |
| 1773 | GCPRO1 (tem); | 1779 | GCPRO1 (tem); |
| 1774 | 1780 | ||
| @@ -1786,9 +1792,14 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1786 | tem = Fcons (args[i], tem); | 1792 | tem = Fcons (args[i], tem); |
| 1787 | CHECK_STRING (XCAR (tem)); | 1793 | CHECK_STRING (XCAR (tem)); |
| 1788 | if (STRING_MULTIBYTE (XCAR (tem))) | 1794 | if (STRING_MULTIBYTE (XCAR (tem))) |
| 1789 | XSETCAR (tem, | 1795 | { |
| 1790 | code_convert_string_norecord | 1796 | if (NILP (arg_encoding)) |
| 1791 | (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1)); | 1797 | arg_encoding = (complement_process_encoding_system |
| 1798 | (XPROCESS (proc)->encode_coding_system)); | ||
| 1799 | XSETCAR (tem, | ||
| 1800 | code_convert_string_norecord | ||
| 1801 | (XCAR (tem), arg_encoding, 1)); | ||
| 1802 | } | ||
| 1792 | } | 1803 | } |
| 1793 | 1804 | ||
| 1794 | UNGCPRO; | 1805 | UNGCPRO; |
| @@ -5690,12 +5701,21 @@ send_process (proc, buf, len, object) | |||
| 5690 | && !NILP (XBUFFER (object)->enable_multibyte_characters)) | 5701 | && !NILP (XBUFFER (object)->enable_multibyte_characters)) |
| 5691 | || EQ (object, Qt)) | 5702 | || EQ (object, Qt)) |
| 5692 | { | 5703 | { |
| 5704 | p->encode_coding_system | ||
| 5705 | = complement_process_encoding_system (p->encode_coding_system); | ||
| 5693 | if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) | 5706 | if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) |
| 5694 | /* The coding system for encoding was changed to raw-text | 5707 | { |
| 5695 | because we sent a unibyte text previously. Now we are | 5708 | /* The coding system for encoding was changed to raw-text |
| 5696 | sending a multibyte text, thus we must encode it by the | 5709 | because we sent a unibyte text previously. Now we are |
| 5697 | original coding system specified for the current process. */ | 5710 | sending a multibyte text, thus we must encode it by the |
| 5698 | setup_coding_system (p->encode_coding_system, coding); | 5711 | original coding system specified for the current process. |
| 5712 | |||
| 5713 | Another reason we comming here is that the coding system | ||
| 5714 | was just complemented and new one was returned by | ||
| 5715 | complement_process_encoding_system. */ | ||
| 5716 | setup_coding_system (p->encode_coding_system, coding); | ||
| 5717 | Vlast_coding_system_used = p->encode_coding_system; | ||
| 5718 | } | ||
| 5699 | coding->src_multibyte = 1; | 5719 | coding->src_multibyte = 1; |
| 5700 | } | 5720 | } |
| 5701 | else | 5721 | else |