comparison src/fileio.c @ 19543:e4cc94034827

(Fwrite_region): Convert EOL format even if enable-multibyte-characters is nil. (Fread_file_name): Call Fcompleting_read with INHERIT-INPUT-METHOD nil.
author Kenichi Handa <handa@m17n.org>
date Tue, 26 Aug 1997 11:42:33 +0000
parents b6517e9b8e60
children 30e299bb4a5d
comparison
equal deleted inserted replaced
19542:6d3cc8864678 19543:e4cc94034827
3858 if (auto_saving) 3858 if (auto_saving)
3859 val = Qnil; 3859 val = Qnil;
3860 else if (!NILP (Vcoding_system_for_write)) 3860 else if (!NILP (Vcoding_system_for_write))
3861 val = Vcoding_system_for_write; 3861 val = Vcoding_system_for_write;
3862 else if (NILP (current_buffer->enable_multibyte_characters)) 3862 else if (NILP (current_buffer->enable_multibyte_characters))
3863 val = (NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)) 3863 {
3864 ? Qnil 3864 /* If the variable `buffer-file-coding-system' is set locally,
3865 : Fsymbol_value (Qbuffer_file_coding_system)); 3865 it means that the file was read with some kind of code
3866 conversion or the varialbe is explicitely set by users. We
3867 had better write it out with the same coding system even if
3868 `enable-multibyte-characters' is nil.
3869
3870 If is is not set locally, we anyway have to convert EOL
3871 format if the default value of `buffer-file-coding-system'
3872 tells that it is not Unix-like (LF only) format. */
3873 val = current_buffer->buffer_file_coding_system;
3874 if (NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil)))
3875 {
3876 struct coding_system coding_temp;
3877
3878 setup_coding_system (Fcheck_coding_system (val), &coding_temp);
3879 if (coding_temp.eol_type == CODING_EOL_CRLF
3880 || coding_temp.eol_type == CODING_EOL_CR)
3881 {
3882 setup_coding_system (Qemacs_mule, &coding);
3883 coding.eol_type = coding_temp.eol_type;
3884 goto done_setup_coding;
3885 }
3886 val = Qnil;
3887 }
3888 }
3866 else 3889 else
3867 { 3890 {
3868 Lisp_Object args[7], coding_systems; 3891 Lisp_Object args[7], coding_systems;
3869 3892
3870 args[0] = Qwrite_region, args[1] = start, args[2] = end, 3893 args[0] = Qwrite_region, args[1] = start, args[2] = end,
3874 val = (CONSP (coding_systems) && !NILP (XCONS (coding_systems)->cdr) 3897 val = (CONSP (coding_systems) && !NILP (XCONS (coding_systems)->cdr)
3875 ? XCONS (coding_systems)->cdr 3898 ? XCONS (coding_systems)->cdr
3876 : current_buffer->buffer_file_coding_system); 3899 : current_buffer->buffer_file_coding_system);
3877 } 3900 }
3878 setup_coding_system (Fcheck_coding_system (val), &coding); 3901 setup_coding_system (Fcheck_coding_system (val), &coding);
3902
3903 done_setup_coding:
3879 if (!STRINGP (start) && !NILP (current_buffer->selective_display)) 3904 if (!STRINGP (start) && !NILP (current_buffer->selective_display))
3880 coding.selective = 1; 3905 coding.selective = 1;
3881 } 3906 }
3882 3907
3883 filename = Fexpand_file_name (filename, Qnil); 3908 filename = Fexpand_file_name (filename, Qnil);
4918 #endif 4943 #endif
4919 4944
4920 GCPRO2 (insdef, default_filename); 4945 GCPRO2 (insdef, default_filename);
4921 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), 4946 val = Fcompleting_read (prompt, intern ("read-file-name-internal"),
4922 dir, mustmatch, insdef1, 4947 dir, mustmatch, insdef1,
4923 Qfile_name_history, default_filename); 4948 Qfile_name_history, default_filename, Qnil);
4924 /* If Fcompleting_read returned the default string itself 4949 /* If Fcompleting_read returned the default string itself
4925 (rather than a new string with the same contents), 4950 (rather than a new string with the same contents),
4926 it has to mean that the user typed RET with the minibuffer empty. 4951 it has to mean that the user typed RET with the minibuffer empty.
4927 In that case, we really want to return "" 4952 In that case, we really want to return ""
4928 so that commands such as set-visited-file-name can distinguish. */ 4953 so that commands such as set-visited-file-name can distinguish. */
4993 5018
4994 GCPRO2 (insdef, defalt); 5019 GCPRO2 (insdef, defalt);
4995 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), 5020 val = Fcompleting_read (prompt, intern ("read-file-name-internal"),
4996 dir, mustmatch, 5021 dir, mustmatch,
4997 insert_default_directory ? insdef : Qnil, 5022 insert_default_directory ? insdef : Qnil,
4998 Qfile_name_history, Qnil); 5023 Qfile_name_history, Qnil, Qnil);
4999 5024
5000 #ifdef VMS 5025 #ifdef VMS
5001 unbind_to (count, Qnil); 5026 unbind_to (count, Qnil);
5002 #endif 5027 #endif
5003 5028