]> git.eshelyaron.com Git - emacs.git/commitdiff
(choose_write_coding_system): Even if
authorKenichi Handa <handa@m17n.org>
Tue, 17 Dec 2002 11:39:59 +0000 (11:39 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 17 Dec 2002 11:39:59 +0000 (11:39 +0000)
Vcoding_system_for_write is non-nil, if
coding_system_require_warning is nonzero, call
Vselect_safe_coding_system_function.

src/fileio.c

index a8d27f0ef2d2019b517fc7a031f05c7ac30edecf..996de3136de886e900227af94d754229f4d59db9 100644 (file)
@@ -4624,7 +4624,15 @@ choose_write_coding_system (start, end, filename,
   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,