diff options
| author | Kenichi Handa | 2008-02-14 12:24:15 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-02-14 12:24:15 +0000 |
| commit | b3bfad50d9766708b954f009b1e690450d3002a6 (patch) | |
| tree | 13da00d5b95c8c6d817ea4a31ab26550676410e4 /src/coding.c | |
| parent | 6edacc4375a694b8d9867187e8fdd6db721125a2 (diff) | |
| download | emacs-b3bfad50d9766708b954f009b1e690450d3002a6.tar.gz emacs-b3bfad50d9766708b954f009b1e690450d3002a6.zip | |
(decode_coding_object, encode_coding_object): Preserve
Vdeactivate_mark. Delete unnecessary call of Fcurrnet_buffer.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/coding.c b/src/coding.c index 8bac5c5ae80..862b5e5f767 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -6852,11 +6852,11 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 6852 | EMACS_INT chars = to - from; | 6852 | EMACS_INT chars = to - from; |
| 6853 | EMACS_INT bytes = to_byte - from_byte; | 6853 | EMACS_INT bytes = to_byte - from_byte; |
| 6854 | Lisp_Object attrs; | 6854 | Lisp_Object attrs; |
| 6855 | Lisp_Object buffer; | ||
| 6856 | int saved_pt = -1, saved_pt_byte; | 6855 | int saved_pt = -1, saved_pt_byte; |
| 6857 | int need_marker_adjustment = 0; | 6856 | int need_marker_adjustment = 0; |
| 6857 | Lisp_Object old_deactivate_mark; | ||
| 6858 | 6858 | ||
| 6859 | buffer = Fcurrent_buffer (); | 6859 | old_deactivate_mark = Vdeactivate_mark; |
| 6860 | 6860 | ||
| 6861 | if (NILP (dst_object)) | 6861 | if (NILP (dst_object)) |
| 6862 | { | 6862 | { |
| @@ -6938,12 +6938,13 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 6938 | 6938 | ||
| 6939 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | 6939 | if (! NILP (CODING_ATTR_POST_READ (attrs))) |
| 6940 | { | 6940 | { |
| 6941 | struct gcpro gcpro1, gcpro2; | 6941 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 6942 | EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE; | 6942 | EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE; |
| 6943 | Lisp_Object val; | 6943 | Lisp_Object val; |
| 6944 | 6944 | ||
| 6945 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); | 6945 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); |
| 6946 | GCPRO2 (coding->src_object, coding->dst_object); | 6946 | GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object, |
| 6947 | old_deactivate_mark); | ||
| 6947 | val = safe_call1 (CODING_ATTR_POST_READ (attrs), | 6948 | val = safe_call1 (CODING_ATTR_POST_READ (attrs), |
| 6948 | make_number (coding->produced_char)); | 6949 | make_number (coding->produced_char)); |
| 6949 | UNGCPRO; | 6950 | UNGCPRO; |
| @@ -6961,8 +6962,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 6961 | set_buffer_internal (XBUFFER (coding->dst_object)); | 6962 | set_buffer_internal (XBUFFER (coding->dst_object)); |
| 6962 | if (dst_bytes < coding->produced) | 6963 | if (dst_bytes < coding->produced) |
| 6963 | { | 6964 | { |
| 6964 | destination | 6965 | destination = xrealloc (destination, coding->produced); |
| 6965 | = (unsigned char *) xrealloc (destination, coding->produced); | ||
| 6966 | if (! destination) | 6966 | if (! destination) |
| 6967 | { | 6967 | { |
| 6968 | record_conversion_result (coding, | 6968 | record_conversion_result (coding, |
| @@ -7019,6 +7019,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7019 | } | 7019 | } |
| 7020 | } | 7020 | } |
| 7021 | 7021 | ||
| 7022 | Vdeactivate_mark = old_deactivate_mark; | ||
| 7022 | unbind_to (count, coding->dst_object); | 7023 | unbind_to (count, coding->dst_object); |
| 7023 | } | 7024 | } |
| 7024 | 7025 | ||
| @@ -7035,12 +7036,12 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7035 | EMACS_INT chars = to - from; | 7036 | EMACS_INT chars = to - from; |
| 7036 | EMACS_INT bytes = to_byte - from_byte; | 7037 | EMACS_INT bytes = to_byte - from_byte; |
| 7037 | Lisp_Object attrs; | 7038 | Lisp_Object attrs; |
| 7038 | Lisp_Object buffer; | ||
| 7039 | int saved_pt = -1, saved_pt_byte; | 7039 | int saved_pt = -1, saved_pt_byte; |
| 7040 | int need_marker_adjustment = 0; | 7040 | int need_marker_adjustment = 0; |
| 7041 | int kill_src_buffer = 0; | 7041 | int kill_src_buffer = 0; |
| 7042 | Lisp_Object old_deactivate_mark; | ||
| 7042 | 7043 | ||
| 7043 | buffer = Fcurrent_buffer (); | 7044 | old_deactivate_mark = Vdeactivate_mark; |
| 7044 | 7045 | ||
| 7045 | coding->src_object = src_object; | 7046 | coding->src_object = src_object; |
| 7046 | coding->src_chars = chars; | 7047 | coding->src_chars = chars; |
| @@ -7082,11 +7083,15 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7082 | 7083 | ||
| 7083 | { | 7084 | { |
| 7084 | Lisp_Object args[3]; | 7085 | Lisp_Object args[3]; |
| 7086 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | ||
| 7085 | 7087 | ||
| 7088 | GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object, | ||
| 7089 | old_deactivate_mark); | ||
| 7086 | args[0] = CODING_ATTR_PRE_WRITE (attrs); | 7090 | args[0] = CODING_ATTR_PRE_WRITE (attrs); |
| 7087 | args[1] = make_number (BEG); | 7091 | args[1] = make_number (BEG); |
| 7088 | args[2] = make_number (Z); | 7092 | args[2] = make_number (Z); |
| 7089 | safe_call (3, args); | 7093 | safe_call (3, args); |
| 7094 | UNGCPRO; | ||
| 7090 | } | 7095 | } |
| 7091 | if (XBUFFER (coding->src_object) != current_buffer) | 7096 | if (XBUFFER (coding->src_object) != current_buffer) |
| 7092 | kill_src_buffer = 1; | 7097 | kill_src_buffer = 1; |
| @@ -7217,6 +7222,8 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7217 | 7222 | ||
| 7218 | if (kill_src_buffer) | 7223 | if (kill_src_buffer) |
| 7219 | Fkill_buffer (coding->src_object); | 7224 | Fkill_buffer (coding->src_object); |
| 7225 | |||
| 7226 | Vdeactivate_mark = old_deactivate_mark; | ||
| 7220 | unbind_to (count, Qnil); | 7227 | unbind_to (count, Qnil); |
| 7221 | } | 7228 | } |
| 7222 | 7229 | ||