diff options
| author | Richard M. Stallman | 1997-07-18 22:56:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-18 22:56:16 +0000 |
| commit | a8c828be8cc3e8b4e0e9cf3c98d3a0d1c43e8eaa (patch) | |
| tree | a2b9215ae96fc486cdad9e50e14a54ccc6b63787 /src | |
| parent | 465edc86d163dfe6476f7c4bf5572da5408b2202 (diff) | |
| download | emacs-a8c828be8cc3e8b4e0e9cf3c98d3a0d1c43e8eaa.tar.gz emacs-a8c828be8cc3e8b4e0e9cf3c98d3a0d1c43e8eaa.zip | |
(Finsert_file_contents) [DOS_NT]: Use the coding
system to determine buffer_file_type.
(Fwrite_region): Only use Qbuffer_file_coding_system
before checking file-coding-system-alist if non-nil.
(Fwrite_region) [DOS_NT]: Delete conditional code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/fileio.c b/src/fileio.c index eda3adf9ddd..b8d7de46f67 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -198,6 +198,8 @@ extern Lisp_Object Vuser_login_name; | |||
| 198 | 198 | ||
| 199 | extern int minibuf_level; | 199 | extern int minibuf_level; |
| 200 | 200 | ||
| 201 | extern int minibuffer_auto_raise; | ||
| 202 | |||
| 201 | /* These variables describe handlers that have "already" had a chance | 203 | /* These variables describe handlers that have "already" had a chance |
| 202 | to handle the current operation. | 204 | to handle the current operation. |
| 203 | 205 | ||
| @@ -3081,6 +3083,16 @@ This does code conversion according to the value of\n\ | |||
| 3081 | setup_coding_system (Fcheck_coding_system (val), &coding); | 3083 | setup_coding_system (Fcheck_coding_system (val), &coding); |
| 3082 | } | 3084 | } |
| 3083 | 3085 | ||
| 3086 | #ifdef DOS_NT | ||
| 3087 | /* Use the conversion type to determine buffer-file-type | ||
| 3088 | (find-buffer-file-type is now used to help determine the | ||
| 3089 | conversion). */ | ||
| 3090 | if (coding.type == coding_type_no_conversion) | ||
| 3091 | current_buffer->buffer_file_type = Qt; | ||
| 3092 | else | ||
| 3093 | current_buffer->buffer_file_type = Qnil; | ||
| 3094 | #endif | ||
| 3095 | |||
| 3084 | fd = -1; | 3096 | fd = -1; |
| 3085 | 3097 | ||
| 3086 | #ifndef APOLLO | 3098 | #ifndef APOLLO |
| @@ -3819,9 +3831,8 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3819 | val = Qnil; | 3831 | val = Qnil; |
| 3820 | else if (!NILP (Vcoding_system_for_write)) | 3832 | else if (!NILP (Vcoding_system_for_write)) |
| 3821 | val = Vcoding_system_for_write; | 3833 | val = Vcoding_system_for_write; |
| 3822 | else if (NILP (current_buffer->enable_multibyte_characters) | 3834 | else if (NILP (current_buffer->enable_multibyte_characters) || |
| 3823 | || !NILP (Flocal_variable_if_set_p (Qbuffer_file_coding_system, | 3835 | ! NILP (Fsymbol_value (Qbuffer_file_coding_system))) |
| 3824 | Qnil))) | ||
| 3825 | val = Fsymbol_value (Qbuffer_file_coding_system); | 3836 | val = Fsymbol_value (Qbuffer_file_coding_system); |
| 3826 | else | 3837 | else |
| 3827 | { | 3838 | { |
| @@ -3838,10 +3849,6 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3838 | setup_coding_system (Fcheck_coding_system (val), &coding); | 3849 | setup_coding_system (Fcheck_coding_system (val), &coding); |
| 3839 | if (!STRINGP (start) && !NILP (current_buffer->selective_display)) | 3850 | if (!STRINGP (start) && !NILP (current_buffer->selective_display)) |
| 3840 | coding.selective = 1; | 3851 | coding.selective = 1; |
| 3841 | #ifdef DOS_NT | ||
| 3842 | if (!NILP (current_buffer->buffer_file_type)) | ||
| 3843 | coding.eol_type = CODING_EOL_LF; | ||
| 3844 | #endif /* DOS_NT */ | ||
| 3845 | } | 3852 | } |
| 3846 | 3853 | ||
| 3847 | filename = Fexpand_file_name (filename, Qnil); | 3854 | filename = Fexpand_file_name (filename, Qnil); |
| @@ -4475,6 +4482,14 @@ do_auto_save_unwind (stream) /* used as unwind-protect function */ | |||
| 4475 | return Qnil; | 4482 | return Qnil; |
| 4476 | } | 4483 | } |
| 4477 | 4484 | ||
| 4485 | static Lisp_Object | ||
| 4486 | do_auto_save_unwind_1 (value) /* used as unwind-protect function */ | ||
| 4487 | Lisp_Object value; | ||
| 4488 | { | ||
| 4489 | minibuffer_auto_raise = XINT (value); | ||
| 4490 | return Qnil; | ||
| 4491 | } | ||
| 4492 | |||
| 4478 | DEFUN ("do-auto-save", Fdo_auto_save, Sdo_auto_save, 0, 2, "", | 4493 | DEFUN ("do-auto-save", Fdo_auto_save, Sdo_auto_save, 0, 2, "", |
| 4479 | "Auto-save all buffers that need it.\n\ | 4494 | "Auto-save all buffers that need it.\n\ |
| 4480 | This is all buffers that have auto-saving enabled\n\ | 4495 | This is all buffers that have auto-saving enabled\n\ |
| @@ -4499,6 +4514,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer.") | |||
| 4499 | Lisp_Object lispstream; | 4514 | Lisp_Object lispstream; |
| 4500 | int count = specpdl_ptr - specpdl; | 4515 | int count = specpdl_ptr - specpdl; |
| 4501 | int *ptr; | 4516 | int *ptr; |
| 4517 | int orig_minibuffer_auto_raise = minibuffer_auto_raise; | ||
| 4502 | 4518 | ||
| 4503 | /* Ordinarily don't quit within this function, | 4519 | /* Ordinarily don't quit within this function, |
| 4504 | but don't make it impossible to quit (in case we get hung in I/O). */ | 4520 | but don't make it impossible to quit (in case we get hung in I/O). */ |
| @@ -4533,7 +4549,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer.") | |||
| 4533 | } | 4549 | } |
| 4534 | 4550 | ||
| 4535 | record_unwind_protect (do_auto_save_unwind, lispstream); | 4551 | record_unwind_protect (do_auto_save_unwind, lispstream); |
| 4536 | 4552 | record_unwind_protect (do_auto_save_unwind_1, | |
| 4553 | make_number (minibuffer_auto_raise)); | ||
| 4554 | minibuffer_auto_raise = 0; | ||
| 4537 | auto_saving = 1; | 4555 | auto_saving = 1; |
| 4538 | 4556 | ||
| 4539 | /* First, save all files which don't have handlers. If Emacs is | 4557 | /* First, save all files which don't have handlers. If Emacs is |
| @@ -4604,8 +4622,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer.") | |||
| 4604 | && NILP (no_message)) | 4622 | && NILP (no_message)) |
| 4605 | { | 4623 | { |
| 4606 | /* It has shrunk too much; turn off auto-saving here. */ | 4624 | /* It has shrunk too much; turn off auto-saving here. */ |
| 4625 | minibuffer_auto_raise = orig_minibuffer_auto_raise; | ||
| 4607 | message ("Buffer %s has shrunk a lot; auto save turned off there", | 4626 | message ("Buffer %s has shrunk a lot; auto save turned off there", |
| 4608 | XSTRING (b->name)->data); | 4627 | XSTRING (b->name)->data); |
| 4628 | minibuffer_auto_raise = 0; | ||
| 4609 | /* Turn off auto-saving until there's a real save, | 4629 | /* Turn off auto-saving until there's a real save, |
| 4610 | and prevent any more warnings. */ | 4630 | and prevent any more warnings. */ |
| 4611 | XSETINT (b->save_length, -1); | 4631 | XSETINT (b->save_length, -1); |
| @@ -4866,6 +4886,13 @@ DIR defaults to current buffer's directory default.") | |||
| 4866 | val = Fcompleting_read (prompt, intern ("read-file-name-internal"), | 4886 | val = Fcompleting_read (prompt, intern ("read-file-name-internal"), |
| 4867 | dir, mustmatch, insdef1, | 4887 | dir, mustmatch, insdef1, |
| 4868 | Qfile_name_history, default_filename); | 4888 | Qfile_name_history, default_filename); |
| 4889 | /* If Fcompleting_read returned the default string itself | ||
| 4890 | (rather than a new string with the same contents), | ||
| 4891 | it has to mean that the user typed RET with the minibuffer empty. | ||
| 4892 | In that case, we really want to return "" | ||
| 4893 | so that commands such as set-visited-file-name can distinguish. */ | ||
| 4894 | if (EQ (val, default_filename)) | ||
| 4895 | val = build_string (""); | ||
| 4869 | 4896 | ||
| 4870 | #ifdef VMS | 4897 | #ifdef VMS |
| 4871 | unbind_to (count, Qnil); | 4898 | unbind_to (count, Qnil); |