Mercurial > emacs
comparison src/process.c @ 110829:4d672e9d91bf
Complement a coding system for encoding arguments and input to a process.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 30 Sep 2010 13:28:34 +0900 |
parents | 44a0c766b765 |
children | bec49af30c2f f2cb0d643a91 |
comparison
equal
deleted
inserted
replaced
110824:bf3b8d29e992 | 110829:4d672e9d91bf |
---|---|
1725 val = XCDR (coding_systems); | 1725 val = XCDR (coding_systems); |
1726 else if (CONSP (Vdefault_process_coding_system)) | 1726 else if (CONSP (Vdefault_process_coding_system)) |
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 |
1733 XPROCESS (proc)->decoding_buf = make_uninit_string (0); | 1738 XPROCESS (proc)->decoding_buf = make_uninit_string (0); |
1734 XPROCESS (proc)->decoding_carryover = 0; | 1739 XPROCESS (proc)->decoding_carryover = 0; |
1767 if (SBYTES (tem) > 2 && SREF (tem, 0) == '/' | 1772 if (SBYTES (tem) > 2 && SREF (tem, 0) == '/' |
1768 && SREF (tem, 1) == ':') | 1773 && SREF (tem, 1) == ':') |
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 |
1775 /* Encode the file name and put it in NEW_ARGV. | 1781 /* Encode the file name and put it in NEW_ARGV. |
1776 That's where the child will use it to execute the program. */ | 1782 That's where the child will use it to execute the program. */ |
1784 for (i = 3; i < nargs; i++) | 1790 for (i = 3; i < nargs; i++) |
1785 { | 1791 { |
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; |
1795 } | 1806 } |
1796 | 1807 |
5688 if ((STRINGP (object) && STRING_MULTIBYTE (object)) | 5699 if ((STRINGP (object) && STRING_MULTIBYTE (object)) |
5689 || (BUFFERP (object) | 5700 || (BUFFERP (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 |
5702 { | 5722 { |
5703 /* For sending a unibyte text, character code conversion should | 5723 /* For sending a unibyte text, character code conversion should |