Commit 5304cb98 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Remove lock file when auto-saving into the visited file

* src/fileio.c (write_region): When auto-saving into the visited
file, unlock the file whenever we mark the buffer unmodified.
(Bug#25470)
parent 5fefaaa8
...@@ -5142,19 +5142,26 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -5142,19 +5142,26 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (! ok) if (! ok)
report_file_errno ("Write error", filename, save_errno); report_file_errno ("Write error", filename, save_errno);
bool auto_saving_into_visited_file =
auto_saving
&& ! NILP (Fstring_equal (BVAR (current_buffer, filename),
BVAR (current_buffer, auto_save_file_name)));
if (visiting) if (visiting)
{ {
SAVE_MODIFF = MODIFF; SAVE_MODIFF = MODIFF;
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
bset_filename (current_buffer, visit_file); bset_filename (current_buffer, visit_file);
update_mode_lines = 14; update_mode_lines = 14;
if (auto_saving_into_visited_file)
unlock_file (lockname);
} }
else if (quietly) else if (quietly)
{ {
if (auto_saving if (auto_saving_into_visited_file)
&& ! NILP (Fstring_equal (BVAR (current_buffer, filename), {
BVAR (current_buffer, auto_save_file_name))))
SAVE_MODIFF = MODIFF; SAVE_MODIFF = MODIFF;
unlock_file (lockname);
}
return Qnil; return Qnil;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment