4583 |
|
|
4584 |
/* Decide the coding-system to encode the data with. */ |
/* Decide the coding-system to encode the data with. */ |
4585 |
|
|
4586 |
void |
static Lisp_Object |
4587 |
choose_write_coding_system (start, end, filename, |
choose_write_coding_system (start, end, filename, |
4588 |
append, visit, lockname, coding) |
append, visit, lockname, coding) |
4589 |
Lisp_Object start, end, filename, append, visit, lockname; |
Lisp_Object start, end, filename, append, visit, lockname; |
4631 |
val = XCDR (coding_systems); |
val = XCDR (coding_systems); |
4632 |
} |
} |
4633 |
|
|
4634 |
if (NILP (val) |
if (NILP (val)) |
|
&& !NILP (current_buffer->buffer_file_coding_system)) |
|
4635 |
{ |
{ |
4636 |
/* If we still have not decided a coding system, use the |
/* If we still have not decided a coding system, use the |
4637 |
default value of buffer-file-coding-system. */ |
default value of buffer-file-coding-system. */ |
4657 |
/* If the decided coding-system doesn't specify end-of-line |
/* If the decided coding-system doesn't specify end-of-line |
4658 |
format, we use that of |
format, we use that of |
4659 |
`default-buffer-file-coding-system'. */ |
`default-buffer-file-coding-system'. */ |
4660 |
if (! using_default_coding) |
if (! using_default_coding |
4661 |
|
&& ! NILP (buffer_defaults.buffer_file_coding_system)) |
4662 |
val = (coding_inherit_eol_type |
val = (coding_inherit_eol_type |
4663 |
(val, buffer_defaults.buffer_file_coding_system)); |
(val, buffer_defaults.buffer_file_coding_system)); |
4664 |
|
|
4668 |
val = raw_text_coding_system (val); |
val = raw_text_coding_system (val); |
4669 |
} |
} |
4670 |
|
|
4671 |
setup_coding_system (Fcheck_coding_system (val), coding); |
setup_coding_system (val, coding); |
4672 |
|
if (! NILP (val) |
4673 |
|
&& VECTORP (CODING_ID_EOL_TYPE (coding->id))) |
4674 |
|
val = AREF (CODING_ID_EOL_TYPE (coding->id), 0); |
4675 |
|
|
4676 |
if (!STRINGP (start) && !NILP (current_buffer->selective_display)) |
if (!STRINGP (start) && !NILP (current_buffer->selective_display)) |
4677 |
coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; |
coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; |
4678 |
|
return val; |
4679 |
} |
} |
4680 |
|
|
4681 |
DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7, |
DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7, |
4811 |
We used to make this choice before calling build_annotations, but that |
We used to make this choice before calling build_annotations, but that |
4812 |
leads to problems when a write-annotate-function takes care of |
leads to problems when a write-annotate-function takes care of |
4813 |
unsavable chars (as was the case with X-Symbol). */ |
unsavable chars (as was the case with X-Symbol). */ |
4814 |
choose_write_coding_system (start, end, filename, |
Vlast_coding_system_used |
4815 |
append, visit, lockname, &coding); |
= choose_write_coding_system (start, end, filename, |
4816 |
Vlast_coding_system_used = CODING_ID_NAME (coding.id); |
append, visit, lockname, &coding); |
4817 |
|
|
4818 |
given_buffer = current_buffer; |
given_buffer = current_buffer; |
4819 |
if (current_buffer != given_buffer) |
if (current_buffer != given_buffer) |