aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-06-26 00:27:04 +0000
committerKenichi Handa2003-06-26 00:27:04 +0000
commitc934586d0e229d2b64d0d4795e458576b67060eb (patch)
tree8edbb880db8f0bcaee144757c0791ddc3406d20a /src
parent8422cc85e81d8749f02809edb1ee19dce934861f (diff)
downloademacs-c934586d0e229d2b64d0d4795e458576b67060eb.tar.gz
emacs-c934586d0e229d2b64d0d4795e458576b67060eb.zip
(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/ChangeLog7
-rw-r--r--src/fileio.c20
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 @@
12003-06-26 Kenichi Handa <handa@etlken2>
2
3 * fileio.c (choose_write_coding_system): Return a decided coding
4 system.
5 (Fwrite_region): Set Vlast_coding_system_used to the return value
6 of choose_write_coding_system.
7
12003-06-06 Kenichi Handa <handa@m17n.org> 82003-06-06 Kenichi Handa <handa@m17n.org>
2 9
3 * charset.c (Fset_charset_priority): Pay attention to duplicated 10 * 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)
4583 4583
4584/* Decide the coding-system to encode the data with. */ 4584/* Decide the coding-system to encode the data with. */
4585 4585
4586void 4586static Lisp_Object
4587choose_write_coding_system (start, end, filename, 4587choose_write_coding_system (start, end, filename,
4588 append, visit, lockname, coding) 4588 append, visit, lockname, coding)
4589 Lisp_Object start, end, filename, append, visit, lockname; 4589 Lisp_Object start, end, filename, append, visit, lockname;
@@ -4631,8 +4631,7 @@ choose_write_coding_system (start, end, filename,
4631 val = XCDR (coding_systems); 4631 val = XCDR (coding_systems);
4632 } 4632 }
4633 4633
4634 if (NILP (val) 4634 if (NILP (val))
4635 && !NILP (current_buffer->buffer_file_coding_system))
4636 { 4635 {
4637 /* If we still have not decided a coding system, use the 4636 /* If we still have not decided a coding system, use the
4638 default value of buffer-file-coding-system. */ 4637 default value of buffer-file-coding-system. */
@@ -4658,7 +4657,8 @@ choose_write_coding_system (start, end, filename,
4658 /* If the decided coding-system doesn't specify end-of-line 4657 /* If the decided coding-system doesn't specify end-of-line
4659 format, we use that of 4658 format, we use that of
4660 `default-buffer-file-coding-system'. */ 4659 `default-buffer-file-coding-system'. */
4661 if (! using_default_coding) 4660 if (! using_default_coding
4661 && ! NILP (buffer_defaults.buffer_file_coding_system))
4662 val = (coding_inherit_eol_type 4662 val = (coding_inherit_eol_type
4663 (val, buffer_defaults.buffer_file_coding_system)); 4663 (val, buffer_defaults.buffer_file_coding_system));
4664 4664
@@ -4668,10 +4668,14 @@ choose_write_coding_system (start, end, filename,
4668 val = raw_text_coding_system (val); 4668 val = raw_text_coding_system (val);
4669 } 4669 }
4670 4670
4671 setup_coding_system (Fcheck_coding_system (val), coding); 4671 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);
4672 4675
4673 if (!STRINGP (start) && !NILP (current_buffer->selective_display)) 4676 if (!STRINGP (start) && !NILP (current_buffer->selective_display))
4674 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; 4677 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4678 return val;
4675} 4679}
4676 4680
4677DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7, 4681DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7,
@@ -4807,9 +4811,9 @@ This does code conversion according to the value of
4807 We used to make this choice before calling build_annotations, but that 4811 We used to make this choice before calling build_annotations, but that
4808 leads to problems when a write-annotate-function takes care of 4812 leads to problems when a write-annotate-function takes care of
4809 unsavable chars (as was the case with X-Symbol). */ 4813 unsavable chars (as was the case with X-Symbol). */
4810 choose_write_coding_system (start, end, filename, 4814 Vlast_coding_system_used
4811 append, visit, lockname, &coding); 4815 = choose_write_coding_system (start, end, filename,
4812 Vlast_coding_system_used = CODING_ID_NAME (coding.id); 4816 append, visit, lockname, &coding);
4813 4817
4814 given_buffer = current_buffer; 4818 given_buffer = current_buffer;
4815 if (current_buffer != given_buffer) 4819 if (current_buffer != given_buffer)