4697 |
if (!NILP (start) && !STRINGP (start)) |
if (!NILP (start) && !STRINGP (start)) |
4698 |
validate_region (&start, &end); |
validate_region (&start, &end); |
4699 |
|
|
4700 |
GCPRO4 (start, filename, visit, lockname); |
GCPRO5 (start, filename, visit, visit_file, lockname); |
|
|
|
|
/* Decide the coding-system to encode the data with. */ |
|
|
choose_write_coding_system (start, end, filename, |
|
|
append, visit, lockname, &coding); |
|
|
Vlast_coding_system_used = coding.symbol; |
|
4701 |
|
|
4702 |
filename = Fexpand_file_name (filename, Qnil); |
filename = Fexpand_file_name (filename, Qnil); |
4703 |
|
|
4708 |
visit_file = Fexpand_file_name (visit, Qnil); |
visit_file = Fexpand_file_name (visit, Qnil); |
4709 |
else |
else |
4710 |
visit_file = filename; |
visit_file = filename; |
|
UNGCPRO; |
|
4711 |
|
|
4712 |
if (NILP (lockname)) |
if (NILP (lockname)) |
4713 |
lockname = visit_file; |
lockname = visit_file; |
4714 |
|
|
4715 |
annotations = Qnil; |
annotations = Qnil; |
4716 |
|
|
|
GCPRO5 (start, filename, annotations, visit_file, lockname); |
|
|
|
|
4717 |
/* If the file name has special constructs in it, |
/* If the file name has special constructs in it, |
4718 |
call the corresponding file handler. */ |
call the corresponding file handler. */ |
4719 |
handler = Ffind_file_name_handler (filename, Qwrite_region); |
handler = Ffind_file_name_handler (filename, Qwrite_region); |
4759 |
|
|
4760 |
GCPRO5 (start, filename, annotations, visit_file, lockname); |
GCPRO5 (start, filename, annotations, visit_file, lockname); |
4761 |
|
|
4762 |
|
/* Decide the coding-system to encode the data with. |
4763 |
|
We used to make this choice before calling build_annotations, but that |
4764 |
|
leads to problems when a write-annotate-function takes care of |
4765 |
|
unsavable chars (as was the case with X-Symbol). */ |
4766 |
|
choose_write_coding_system (start, end, filename, |
4767 |
|
append, visit, lockname, &coding); |
4768 |
|
Vlast_coding_system_used = coding.symbol; |
4769 |
|
|
4770 |
given_buffer = current_buffer; |
given_buffer = current_buffer; |
4771 |
annotations = build_annotations_2 (start, end, |
annotations = build_annotations_2 (start, end, |
4772 |
coding.pre_write_conversion, annotations); |
coding.pre_write_conversion, annotations); |