From 42b01e1e9b09b8e8fbbfe921a894e01bd0de4d44 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 17 Dec 2002 11:39:59 +0000 Subject: [PATCH] (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. --- src/fileio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index a8d27f0ef2d..996de3136de 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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, -- 2.39.5