Mercurial > emacs
comparison src/fileio.c @ 53363:d6ab4f5d0c6f
(choose_write_coding_system): Ignore auto_saving
if using the visited file for auto saves.
(Fwrite_region): Don't update SAVE_MODIFF
if auto-saving in visited file.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 29 Dec 2003 11:24:14 +0000 |
parents | 2c1d6f1a791e |
children | 0505a2aecd0a |
comparison
equal
deleted
inserted
replaced
53362:35a817bb4c0d | 53363:d6ab4f5d0c6f |
---|---|
4683 Lisp_Object start, end, filename, append, visit, lockname; | 4683 Lisp_Object start, end, filename, append, visit, lockname; |
4684 struct coding_system *coding; | 4684 struct coding_system *coding; |
4685 { | 4685 { |
4686 Lisp_Object val; | 4686 Lisp_Object val; |
4687 | 4687 |
4688 if (auto_saving) | 4688 if (auto_saving |
4689 && NILP (Fstring_equal (current_buffer->filename, | |
4690 current_buffer->auto_save_file_name))) | |
4689 { | 4691 { |
4690 /* We use emacs-mule for auto saving... */ | 4692 /* We use emacs-mule for auto saving... */ |
4691 setup_coding_system (Qemacs_mule, coding); | 4693 setup_coding_system (Qemacs_mule, coding); |
4692 /* ... but with the special flag to indicate not to strip off | 4694 /* ... but with the special flag to indicate not to strip off |
4693 leading code of eight-bit-control chars. */ | 4695 leading code of eight-bit-control chars. */ |
5219 XSETFASTINT (current_buffer->save_length, Z - BEG); | 5221 XSETFASTINT (current_buffer->save_length, Z - BEG); |
5220 current_buffer->filename = visit_file; | 5222 current_buffer->filename = visit_file; |
5221 update_mode_lines++; | 5223 update_mode_lines++; |
5222 } | 5224 } |
5223 else if (quietly) | 5225 else if (quietly) |
5224 return Qnil; | 5226 { |
5227 if (auto_saving | |
5228 && ! NILP (Fstring_equal (current_buffer->filename, | |
5229 current_buffer->auto_save_file_name))) | |
5230 SAVE_MODIFF = MODIFF; | |
5231 | |
5232 return Qnil; | |
5233 } | |
5225 | 5234 |
5226 if (!auto_saving) | 5235 if (!auto_saving) |
5227 message_with_string ((INTEGERP (append) | 5236 message_with_string ((INTEGERP (append) |
5228 ? "Updated %s" | 5237 ? "Updated %s" |
5229 : ! NILP (append) | 5238 : ! NILP (append) |
5774 record_unwind_protect (do_auto_save_unwind_1, | 5783 record_unwind_protect (do_auto_save_unwind_1, |
5775 make_number (minibuffer_auto_raise)); | 5784 make_number (minibuffer_auto_raise)); |
5776 minibuffer_auto_raise = 0; | 5785 minibuffer_auto_raise = 0; |
5777 auto_saving = 1; | 5786 auto_saving = 1; |
5778 | 5787 |
5779 /* First, save all files which don't have handlers. If Emacs is | 5788 /* On first pass, save all files that don't have handlers. |
5780 crashing, the handlers may tweak what is causing Emacs to crash | 5789 On second pass, save all files that do have handlers. |
5781 in the first place, and it would be a shame if Emacs failed to | 5790 |
5782 autosave perfectly ordinary files because it couldn't handle some | 5791 If Emacs is crashing, the handlers may tweak what is causing |
5783 ange-ftp'd file. */ | 5792 Emacs to crash in the first place, and it would be a shame if |
5793 Emacs failed to autosave perfectly ordinary files because it | |
5794 couldn't handle some ange-ftp'd file. */ | |
5795 | |
5784 for (do_handled_files = 0; do_handled_files < 2; do_handled_files++) | 5796 for (do_handled_files = 0; do_handled_files < 2; do_handled_files++) |
5785 for (tail = Vbuffer_alist; GC_CONSP (tail); tail = XCDR (tail)) | 5797 for (tail = Vbuffer_alist; GC_CONSP (tail); tail = XCDR (tail)) |
5786 { | 5798 { |
5787 buf = XCDR (XCAR (tail)); | 5799 buf = XCDR (XCAR (tail)); |
5788 b = XBUFFER (buf); | 5800 b = XBUFFER (buf); |