diff options
author | Stefan Monnier <[email protected]> | 2001-11-19 21:50:44 +0000 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2001-11-19 21:50:44 +0000 |
commit | 59fac292ee4f5cd5770fe9b9ec7150365e54f502 (patch) | |
tree | a7a14a42b1cc22c468d6667a6d8db552ffe638af /src/fileio.c | |
parent | 8ae3ef6ea3b19c257f55eff97e8decc19a4d5341 (diff) |
(Fwrite_region): Move choose_write_coding_system to after build_annotations.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fileio.c b/src/fileio.c index 93aae5da50..cc1c7a5a33 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4697,12 +4697,7 @@ This does code conversion according to the value of if (!NILP (start) && !STRINGP (start)) validate_region (&start, &end); - GCPRO4 (start, filename, visit, 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; + GCPRO5 (start, filename, visit, visit_file, lockname); filename = Fexpand_file_name (filename, Qnil); @@ -4713,15 +4708,12 @@ This does code conversion according to the value of visit_file = Fexpand_file_name (visit, Qnil); else visit_file = filename; - UNGCPRO; if (NILP (lockname)) lockname = visit_file; annotations = Qnil; - GCPRO5 (start, filename, annotations, visit_file, lockname); - /* If the file name has special constructs in it, call the corresponding file handler. */ handler = Ffind_file_name_handler (filename, Qwrite_region); @@ -4767,6 +4759,14 @@ This does code conversion according to the value of GCPRO5 (start, filename, annotations, visit_file, lockname); + /* Decide the coding-system to encode the data with. + We used to make this choice before calling build_annotations, but that + leads to problems when a write-annotate-function takes care of + unsavable chars (as was the case with X-Symbol). */ + choose_write_coding_system (start, end, filename, + append, visit, lockname, &coding); + Vlast_coding_system_used = coding.symbol; + given_buffer = current_buffer; annotations = build_annotations_2 (start, end, coding.pre_write_conversion, annotations); |