diff options
| -rw-r--r-- | src/fileio.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c index b82b7d360b5..3155ef0edf1 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3470,7 +3470,11 @@ by calling `format-decode', which see. */) | |||
| 3470 | mtime = time_error_value (save_errno); | 3470 | mtime = time_error_value (save_errno); |
| 3471 | st.st_size = -1; | 3471 | st.st_size = -1; |
| 3472 | if (!NILP (Vcoding_system_for_read)) | 3472 | if (!NILP (Vcoding_system_for_read)) |
| 3473 | Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); | 3473 | { |
| 3474 | /* Don't let invalid values into buffer-file-coding-system. */ | ||
| 3475 | CHECK_CODING_SYSTEM (Vcoding_system_for_read); | ||
| 3476 | Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); | ||
| 3477 | } | ||
| 3474 | goto notfound; | 3478 | goto notfound; |
| 3475 | } | 3479 | } |
| 3476 | 3480 | ||
| @@ -4569,7 +4573,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file | |||
| 4569 | if (NILP (val)) | 4573 | if (NILP (val)) |
| 4570 | { | 4574 | { |
| 4571 | /* If we still have not decided a coding system, use the | 4575 | /* If we still have not decided a coding system, use the |
| 4572 | default value of buffer-file-coding-system. */ | 4576 | current buffer's value of buffer-file-coding-system. */ |
| 4573 | val = BVAR (current_buffer, buffer_file_coding_system); | 4577 | val = BVAR (current_buffer, buffer_file_coding_system); |
| 4574 | using_default_coding = 1; | 4578 | using_default_coding = 1; |
| 4575 | } | 4579 | } |
| @@ -4587,9 +4591,16 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file | |||
| 4587 | 4591 | ||
| 4588 | if (!force_raw_text | 4592 | if (!force_raw_text |
| 4589 | && !NILP (Ffboundp (Vselect_safe_coding_system_function))) | 4593 | && !NILP (Ffboundp (Vselect_safe_coding_system_function))) |
| 4590 | /* Confirm that VAL can surely encode the current region. */ | 4594 | { |
| 4591 | val = call5 (Vselect_safe_coding_system_function, | 4595 | /* Confirm that VAL can surely encode the current region. */ |
| 4592 | start, end, val, Qnil, filename); | 4596 | val = call5 (Vselect_safe_coding_system_function, |
| 4597 | start, end, val, Qnil, filename); | ||
| 4598 | /* As the function specified by select-safe-coding-system-function | ||
| 4599 | is out of our control, make sure we are not fed by bogus | ||
| 4600 | values. */ | ||
| 4601 | if (!NILP (val)) | ||
| 4602 | CHECK_CODING_SYSTEM (val); | ||
| 4603 | } | ||
| 4593 | 4604 | ||
| 4594 | /* If the decided coding-system doesn't specify end-of-line | 4605 | /* If the decided coding-system doesn't specify end-of-line |
| 4595 | format, we use that of | 4606 | format, we use that of |