diff options
| author | Karoly Lorentey | 2005-09-17 19:10:55 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-09-17 19:10:55 +0000 |
| commit | 5826661f18ae8c95b26951a042692e68b9bc093f (patch) | |
| tree | 534dee8bd5250e83e84a896ebd29f82be3370c07 /src/coding.c | |
| parent | 567c887847144d9609ccfe550fd7ef178120297a (diff) | |
| parent | 5b51c03716d7c487d1c2336df2a76a6417a2343c (diff) | |
| download | emacs-5826661f18ae8c95b26951a042692e68b9bc093f.tar.gz emacs-5826661f18ae8c95b26951a042692e68b9bc093f.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 116-117, 544-550)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-544
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-545
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-546
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-547
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-548
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-549
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-550
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-116
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-117
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-421
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/coding.c b/src/coding.c index 9d2d04af6cb..5658a8ab09a 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5349,8 +5349,8 @@ static int shrink_conversion_region_threshhold = 1024; | |||
| 5349 | } \ | 5349 | } \ |
| 5350 | } while (0) | 5350 | } while (0) |
| 5351 | 5351 | ||
| 5352 | /* ARG is (CODING . BUFFER) where CODING is what to be set in | 5352 | /* ARG is (CODING BUFFER ...) where CODING is what to be set in |
| 5353 | Vlast_coding_system_used and BUFFER if non-nil is a buffer to | 5353 | Vlast_coding_system_used and the remaining elements are buffers to |
| 5354 | kill. */ | 5354 | kill. */ |
| 5355 | static Lisp_Object | 5355 | static Lisp_Object |
| 5356 | code_convert_region_unwind (arg) | 5356 | code_convert_region_unwind (arg) |
| @@ -5358,8 +5358,8 @@ code_convert_region_unwind (arg) | |||
| 5358 | { | 5358 | { |
| 5359 | inhibit_pre_post_conversion = 0; | 5359 | inhibit_pre_post_conversion = 0; |
| 5360 | Vlast_coding_system_used = XCAR (arg); | 5360 | Vlast_coding_system_used = XCAR (arg); |
| 5361 | if (! NILP (XCDR (arg))) | 5361 | for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg)) |
| 5362 | Fkill_buffer (XCDR (arg)); | 5362 | Fkill_buffer (XCAR (arg)); |
| 5363 | return Qnil; | 5363 | return Qnil; |
| 5364 | } | 5364 | } |
| 5365 | 5365 | ||
| @@ -6077,6 +6077,7 @@ run_pre_post_conversion_on_str (str, coding, encodep) | |||
| 6077 | int multibyte = STRING_MULTIBYTE (str); | 6077 | int multibyte = STRING_MULTIBYTE (str); |
| 6078 | Lisp_Object old_deactivate_mark; | 6078 | Lisp_Object old_deactivate_mark; |
| 6079 | Lisp_Object buffer_to_kill; | 6079 | Lisp_Object buffer_to_kill; |
| 6080 | Lisp_Object unwind_arg; | ||
| 6080 | 6081 | ||
| 6081 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 6082 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
| 6082 | /* It is not crucial to specbind this. */ | 6083 | /* It is not crucial to specbind this. */ |
| @@ -6087,15 +6088,25 @@ run_pre_post_conversion_on_str (str, coding, encodep) | |||
| 6087 | unibyte<->multibyte conversion. For that, we adjust the | 6088 | unibyte<->multibyte conversion. For that, we adjust the |
| 6088 | multibyteness of the working buffer to that of STR. */ | 6089 | multibyteness of the working buffer to that of STR. */ |
| 6089 | buffer_to_kill = set_conversion_work_buffer (multibyte); | 6090 | buffer_to_kill = set_conversion_work_buffer (multibyte); |
| 6090 | record_unwind_protect (code_convert_region_unwind, | 6091 | if (NILP (buffer_to_kill)) |
| 6091 | Fcons (Vlast_coding_system_used, buffer_to_kill)); | 6092 | unwind_arg = Fcons (Vlast_coding_system_used, Qnil); |
| 6093 | else | ||
| 6094 | unwind_arg = list2 (Vlast_coding_system_used, buffer_to_kill); | ||
| 6095 | record_unwind_protect (code_convert_region_unwind, unwind_arg); | ||
| 6092 | 6096 | ||
| 6093 | insert_from_string (str, 0, 0, | 6097 | insert_from_string (str, 0, 0, |
| 6094 | SCHARS (str), SBYTES (str), 0); | 6098 | SCHARS (str), SBYTES (str), 0); |
| 6095 | UNGCPRO; | 6099 | UNGCPRO; |
| 6096 | inhibit_pre_post_conversion = 1; | 6100 | inhibit_pre_post_conversion = 1; |
| 6097 | if (encodep) | 6101 | if (encodep) |
| 6098 | call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); | 6102 | { |
| 6103 | struct buffer *prev = current_buffer; | ||
| 6104 | |||
| 6105 | call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); | ||
| 6106 | if (prev != current_buffer) | ||
| 6107 | /* We must kill the current buffer too. */ | ||
| 6108 | Fsetcdr (unwind_arg, Fcons (Fcurrent_buffer (), XCDR (unwind_arg))); | ||
| 6109 | } | ||
| 6099 | else | 6110 | else |
| 6100 | { | 6111 | { |
| 6101 | Vlast_coding_system_used = coding->symbol; | 6112 | Vlast_coding_system_used = coding->symbol; |
| @@ -6129,6 +6140,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) | |||
| 6129 | { | 6140 | { |
| 6130 | struct gcpro gcpro1, gcpro2; | 6141 | struct gcpro gcpro1, gcpro2; |
| 6131 | struct buffer *cur = current_buffer; | 6142 | struct buffer *cur = current_buffer; |
| 6143 | struct buffer *prev; | ||
| 6132 | Lisp_Object old_deactivate_mark, old_last_coding_system_used; | 6144 | Lisp_Object old_deactivate_mark, old_last_coding_system_used; |
| 6133 | Lisp_Object args[3]; | 6145 | Lisp_Object args[3]; |
| 6134 | Lisp_Object buffer_to_kill; | 6146 | Lisp_Object buffer_to_kill; |
| @@ -6145,6 +6157,7 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) | |||
| 6145 | insert_1_both (*str, nchars, nbytes, 0, 0, 0); | 6157 | insert_1_both (*str, nchars, nbytes, 0, 0, 0); |
| 6146 | UNGCPRO; | 6158 | UNGCPRO; |
| 6147 | inhibit_pre_post_conversion = 1; | 6159 | inhibit_pre_post_conversion = 1; |
| 6160 | prev = current_buffer; | ||
| 6148 | args[0] = coding->pre_write_conversion; | 6161 | args[0] = coding->pre_write_conversion; |
| 6149 | args[1] = make_number (BEG); | 6162 | args[1] = make_number (BEG); |
| 6150 | args[2] = make_number (Z); | 6163 | args[2] = make_number (Z); |
| @@ -6164,6 +6177,8 @@ run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) | |||
| 6164 | bcopy (BEG_ADDR, *str, coding->produced); | 6177 | bcopy (BEG_ADDR, *str, coding->produced); |
| 6165 | coding->src_multibyte | 6178 | coding->src_multibyte |
| 6166 | = ! NILP (current_buffer->enable_multibyte_characters); | 6179 | = ! NILP (current_buffer->enable_multibyte_characters); |
| 6180 | if (prev != current_buffer) | ||
| 6181 | Fkill_buffer (Fcurrent_buffer ()); | ||
| 6167 | set_buffer_internal (cur); | 6182 | set_buffer_internal (cur); |
| 6168 | if (! NILP (buffer_to_kill)) | 6183 | if (! NILP (buffer_to_kill)) |
| 6169 | Fkill_buffer (buffer_to_kill); | 6184 | Fkill_buffer (buffer_to_kill); |