diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index a293d15988a..f989da12b6d 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -4645,6 +4645,7 @@ code_convert_region1 (start, end, coding_system, encodep) | |||
| 4645 | coding.mode |= CODING_MODE_LAST_BLOCK; | 4645 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 4646 | code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), | 4646 | code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), |
| 4647 | &coding, encodep, 1); | 4647 | &coding, encodep, 1); |
| 4648 | Vlast_coding_system_used = coding.symbol; | ||
| 4648 | return make_number (coding.produced_char); | 4649 | return make_number (coding.produced_char); |
| 4649 | } | 4650 | } |
| 4650 | 4651 | ||
| @@ -4653,7 +4654,10 @@ DEFUN ("decode-coding-region", Fdecode_coding_region, Sdecode_coding_region, | |||
| 4653 | "Decode the current region by specified coding system.\n\ | 4654 | "Decode the current region by specified coding system.\n\ |
| 4654 | When called from a program, takes three arguments:\n\ | 4655 | When called from a program, takes three arguments:\n\ |
| 4655 | START, END, and CODING-SYSTEM. START and END are buffer positions.\n\ | 4656 | START, END, and CODING-SYSTEM. START and END are buffer positions.\n\ |
| 4656 | Return length of decoded text.") | 4657 | This function sets `last-coding-system-used' to the precise coding system\n\ |
| 4658 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is\n\ | ||
| 4659 | not fully specified.)\n\ | ||
| 4660 | It returns the length of the decoded text.") | ||
| 4657 | (start, end, coding_system) | 4661 | (start, end, coding_system) |
| 4658 | Lisp_Object start, end, coding_system; | 4662 | Lisp_Object start, end, coding_system; |
| 4659 | { | 4663 | { |
| @@ -4665,7 +4669,10 @@ DEFUN ("encode-coding-region", Fencode_coding_region, Sencode_coding_region, | |||
| 4665 | "Encode the current region by specified coding system.\n\ | 4669 | "Encode the current region by specified coding system.\n\ |
| 4666 | When called from a program, takes three arguments:\n\ | 4670 | When called from a program, takes three arguments:\n\ |
| 4667 | START, END, and CODING-SYSTEM. START and END are buffer positions.\n\ | 4671 | START, END, and CODING-SYSTEM. START and END are buffer positions.\n\ |
| 4668 | Return length of encoded text.") | 4672 | This function sets `last-coding-system-used' to the precise coding system\n\ |
| 4673 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is\n\ | ||
| 4674 | not fully specified.)\n\ | ||
| 4675 | It returns the length of the encoded text.") | ||
| 4669 | (start, end, coding_system) | 4676 | (start, end, coding_system) |
| 4670 | Lisp_Object start, end, coding_system; | 4677 | Lisp_Object start, end, coding_system; |
| 4671 | { | 4678 | { |
| @@ -4689,6 +4696,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep) | |||
| 4689 | error ("Invalid coding system: %s", XSYMBOL (coding_system)->name->data); | 4696 | error ("Invalid coding system: %s", XSYMBOL (coding_system)->name->data); |
| 4690 | 4697 | ||
| 4691 | coding.mode |= CODING_MODE_LAST_BLOCK; | 4698 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 4699 | Vlast_coding_system_used = coding.symbol; | ||
| 4692 | return code_convert_string (string, &coding, encodep, !NILP (nocopy)); | 4700 | return code_convert_string (string, &coding, encodep, !NILP (nocopy)); |
| 4693 | } | 4701 | } |
| 4694 | 4702 | ||
| @@ -4696,22 +4704,28 @@ DEFUN ("decode-coding-string", Fdecode_coding_string, Sdecode_coding_string, | |||
| 4696 | 2, 3, 0, | 4704 | 2, 3, 0, |
| 4697 | "Decode STRING which is encoded in CODING-SYSTEM, and return the result.\n\ | 4705 | "Decode STRING which is encoded in CODING-SYSTEM, and return the result.\n\ |
| 4698 | Optional arg NOCOPY non-nil means it is ok to return STRING itself\n\ | 4706 | Optional arg NOCOPY non-nil means it is ok to return STRING itself\n\ |
| 4699 | if the decoding operation is trivial.") | 4707 | if the decoding operation is trivial.\n\ |
| 4708 | This function sets `last-coding-system-used' to the precise coding system\n\ | ||
| 4709 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is\n\ | ||
| 4710 | not fully specified.)") | ||
| 4700 | (string, coding_system, nocopy) | 4711 | (string, coding_system, nocopy) |
| 4701 | Lisp_Object string, coding_system, nocopy; | 4712 | Lisp_Object string, coding_system, nocopy; |
| 4702 | { | 4713 | { |
| 4703 | return code_convert_string1(string, coding_system, nocopy, 0); | 4714 | return code_convert_string1 (string, coding_system, nocopy, 0); |
| 4704 | } | 4715 | } |
| 4705 | 4716 | ||
| 4706 | DEFUN ("encode-coding-string", Fencode_coding_string, Sencode_coding_string, | 4717 | DEFUN ("encode-coding-string", Fencode_coding_string, Sencode_coding_string, |
| 4707 | 2, 3, 0, | 4718 | 2, 3, 0, |
| 4708 | "Encode STRING to CODING-SYSTEM, and return the result.\n\ | 4719 | "Encode STRING to CODING-SYSTEM, and return the result.\n\ |
| 4709 | Optional arg NOCOPY non-nil means it is ok to return STRING itself\n\ | 4720 | Optional arg NOCOPY non-nil means it is ok to return STRING itself\n\ |
| 4710 | if the encoding operation is trivial.") | 4721 | if the encoding operation is trivial.\n\ |
| 4722 | This function sets `last-coding-system-used' to the precise coding system\n\ | ||
| 4723 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is\n\ | ||
| 4724 | not fully specified.)") | ||
| 4711 | (string, coding_system, nocopy) | 4725 | (string, coding_system, nocopy) |
| 4712 | Lisp_Object string, coding_system, nocopy; | 4726 | Lisp_Object string, coding_system, nocopy; |
| 4713 | { | 4727 | { |
| 4714 | return code_convert_string1(string, coding_system, nocopy, 1); | 4728 | return code_convert_string1 (string, coding_system, nocopy, 1); |
| 4715 | } | 4729 | } |
| 4716 | 4730 | ||
| 4717 | 4731 | ||