diff options
| author | Kenichi Handa <handa@m17n.org> | 2003-06-26 00:27:04 +0000 |
|---|---|---|
| committer | Kenichi Handa <handa@m17n.org> | 2003-06-26 00:27:04 +0000 |
| commit | c934586d0e229d2b64d0d4795e458576b67060eb (patch) | |
| tree | 8edbb880db8f0bcaee144757c0791ddc3406d20a /src | |
| parent | 8422cc85e81d8749f02809edb1ee19dce934861f (diff) | |
| download | emacs-c934586d0e229d2b64d0d4795e458576b67060eb.tar.gz | |
(choose_write_coding_system): Return a decided coding system.
(Fwrite_region): Set Vlast_coding_system_used to the return value
of choose_write_coding_system.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/fileio.c | 20 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 57c96d05c19..e107c6641bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-06-26 Kenichi Handa <handa@etlken2> + + * fileio.c (choose_write_coding_system): Return a decided coding + system. + (Fwrite_region): Set Vlast_coding_system_used to the return value + of choose_write_coding_system. + 2003-06-06 Kenichi Handa <handa@m17n.org> * charset.c (Fset_charset_priority): Pay attention to duplicated diff --git a/src/fileio.c b/src/fileio.c index 86ac8a32570..c0a5c75f95b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4583,7 +4583,7 @@ build_annotations_unwind (buf) /* Decide the coding-system to encode the data with. */ -void +static Lisp_Object choose_write_coding_system (start, end, filename, append, visit, lockname, coding) Lisp_Object start, end, filename, append, visit, lockname; @@ -4631,8 +4631,7 @@ choose_write_coding_system (start, end, filename, val = XCDR (coding_systems); } - if (NILP (val) - && !NILP (current_buffer->buffer_file_coding_system)) + if (NILP (val)) { /* If we still have not decided a coding system, use the default value of buffer-file-coding-system. */ @@ -4658,7 +4657,8 @@ choose_write_coding_system (start, end, filename, /* If the decided coding-system doesn't specify end-of-line format, we use that of `default-buffer-file-coding-system'. */ - if (! using_default_coding) + if (! using_default_coding + && ! NILP (buffer_defaults.buffer_file_coding_system)) val = (coding_inherit_eol_type (val, buffer_defaults.buffer_file_coding_system)); @@ -4668,10 +4668,14 @@ choose_write_coding_system (start, end, filename, val = raw_text_coding_system (val); } - setup_coding_system (Fcheck_coding_system (val), coding); + setup_coding_system (val, coding); + if (! NILP (val) + && VECTORP (CODING_ID_EOL_TYPE (coding->id))) + val = AREF (CODING_ID_EOL_TYPE (coding->id), 0); if (!STRINGP (start) && !NILP (current_buffer->selective_display)) coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; + return val; } DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7, @@ -4807,9 +4811,9 @@ This does code conversion according to the value of 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_ID_NAME (coding.id); + Vlast_coding_system_used + = choose_write_coding_system (start, end, filename, + append, visit, lockname, &coding); given_buffer = current_buffer; if (current_buffer != given_buffer) |
