changeset 48876:0b4aeb4594ad

(choose_write_coding_system): Even if Vcoding_system_for_write is non-nil, if coding_system_require_warning is nonzero, call Vselect_safe_coding_system_function.
author Kenichi Handa <handa@m17n.org>
date Tue, 17 Dec 2002 11:39:59 +0000
parents e79464fe61d7
children c7299043f7f4
files src/fileio.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Tue Dec 17 11:39:34 2002 +0000
+++ b/src/fileio.c	Tue Dec 17 11:39:59 2002 +0000
@@ -4624,7 +4624,15 @@
   if (auto_saving)
     val = Qnil;
   else if (!NILP (Vcoding_system_for_write))
-    val = Vcoding_system_for_write;
+    {
+      val = Vcoding_system_for_write;
+      if (coding_system_require_warning
+	  && !NILP (Ffboundp (Vselect_safe_coding_system_function)))
+	/* Confirm that VAL can surely encode the current region.  */
+	val = call5 (Vselect_safe_coding_system_function,
+		     start, end, Fcons (Qt, Fcons (val, Qnil)),
+		     Qnil, filename);
+    }
   else
     {
       /* If the variable `buffer-file-coding-system' is set locally,