5353 |
} \ |
} \ |
5354 |
} while (0) |
} while (0) |
5355 |
|
|
5356 |
/* ARG is (CODING . BUFFER) where CODING is what to be set in |
/* ARG is (CODING BUFFER ...) where CODING is what to be set in |
5357 |
Vlast_coding_system_used and BUFFER if non-nil is a buffer to |
Vlast_coding_system_used and the remaining elements are buffers to |
5358 |
kill. */ |
kill. */ |
5359 |
static Lisp_Object |
static Lisp_Object |
5360 |
code_convert_region_unwind (arg) |
code_convert_region_unwind (arg) |
5362 |
{ |
{ |
5363 |
inhibit_pre_post_conversion = 0; |
inhibit_pre_post_conversion = 0; |
5364 |
Vlast_coding_system_used = XCAR (arg); |
Vlast_coding_system_used = XCAR (arg); |
5365 |
if (! NILP (XCDR (arg))) |
for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg)) |
5366 |
Fkill_buffer (XCDR (arg)); |
Fkill_buffer (XCAR (arg)); |
5367 |
return Qnil; |
return Qnil; |
5368 |
} |
} |
5369 |
|
|
6081 |
int multibyte = STRING_MULTIBYTE (str); |
int multibyte = STRING_MULTIBYTE (str); |
6082 |
Lisp_Object old_deactivate_mark; |
Lisp_Object old_deactivate_mark; |
6083 |
Lisp_Object buffer_to_kill; |
Lisp_Object buffer_to_kill; |
6084 |
|
Lisp_Object unwind_arg; |
6085 |
|
|
6086 |
record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
6087 |
/* It is not crucial to specbind this. */ |
/* It is not crucial to specbind this. */ |
6092 |
unibyte<->multibyte conversion. For that, we adjust the |
unibyte<->multibyte conversion. For that, we adjust the |
6093 |
multibyteness of the working buffer to that of STR. */ |
multibyteness of the working buffer to that of STR. */ |
6094 |
buffer_to_kill = set_conversion_work_buffer (multibyte); |
buffer_to_kill = set_conversion_work_buffer (multibyte); |
6095 |
record_unwind_protect (code_convert_region_unwind, |
if (NILP (buffer_to_kill)) |
6096 |
Fcons (Vlast_coding_system_used, buffer_to_kill)); |
unwind_arg = Fcons (Vlast_coding_system_used, Qnil); |
6097 |
|
else |
6098 |
|
unwind_arg = list2 (Vlast_coding_system_used, buffer_to_kill); |
6099 |
|
record_unwind_protect (code_convert_region_unwind, unwind_arg); |
6100 |
|
|
6101 |
insert_from_string (str, 0, 0, |
insert_from_string (str, 0, 0, |
6102 |
SCHARS (str), SBYTES (str), 0); |
SCHARS (str), SBYTES (str), 0); |
6103 |
UNGCPRO; |
UNGCPRO; |
6104 |
inhibit_pre_post_conversion = 1; |
inhibit_pre_post_conversion = 1; |
6105 |
if (encodep) |
if (encodep) |
6106 |
call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); |
{ |
6107 |
|
struct buffer *prev = current_buffer; |
6108 |
|
|
6109 |
|
call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); |
6110 |
|
if (prev != current_buffer) |
6111 |
|
/* We must kill the current buffer too. */ |
6112 |
|
Fsetcdr (unwind_arg, Fcons (Fcurrent_buffer (), XCDR (unwind_arg))); |
6113 |
|
} |
6114 |
else |
else |
6115 |
{ |
{ |
6116 |
Vlast_coding_system_used = coding->symbol; |
Vlast_coding_system_used = coding->symbol; |
6144 |
{ |
{ |
6145 |
struct gcpro gcpro1, gcpro2; |
struct gcpro gcpro1, gcpro2; |
6146 |
struct buffer *cur = current_buffer; |
struct buffer *cur = current_buffer; |
6147 |
|
struct buffer *prev; |
6148 |
Lisp_Object old_deactivate_mark, old_last_coding_system_used; |
Lisp_Object old_deactivate_mark, old_last_coding_system_used; |
6149 |
Lisp_Object args[3]; |
Lisp_Object args[3]; |
6150 |
Lisp_Object buffer_to_kill; |
Lisp_Object buffer_to_kill; |
6161 |
insert_1_both (*str, nchars, nbytes, 0, 0, 0); |
insert_1_both (*str, nchars, nbytes, 0, 0, 0); |
6162 |
UNGCPRO; |
UNGCPRO; |
6163 |
inhibit_pre_post_conversion = 1; |
inhibit_pre_post_conversion = 1; |
6164 |
|
prev = current_buffer; |
6165 |
args[0] = coding->pre_write_conversion; |
args[0] = coding->pre_write_conversion; |
6166 |
args[1] = make_number (BEG); |
args[1] = make_number (BEG); |
6167 |
args[2] = make_number (Z); |
args[2] = make_number (Z); |
6181 |
bcopy (BEG_ADDR, *str, coding->produced); |
bcopy (BEG_ADDR, *str, coding->produced); |
6182 |
coding->src_multibyte |
coding->src_multibyte |
6183 |
= ! NILP (current_buffer->enable_multibyte_characters); |
= ! NILP (current_buffer->enable_multibyte_characters); |
6184 |
|
if (prev != current_buffer) |
6185 |
|
Fkill_buffer (Fcurrent_buffer ()); |
6186 |
set_buffer_internal (cur); |
set_buffer_internal (cur); |
6187 |
if (! NILP (buffer_to_kill)) |
if (! NILP (buffer_to_kill)) |
6188 |
Fkill_buffer (buffer_to_kill); |
Fkill_buffer (buffer_to_kill); |