]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove lock file when auto-saving into the visited file
authorEli Zaretskii <eliz@gnu.org>
Wed, 18 Jan 2017 18:36:14 +0000 (20:36 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 18 Jan 2017 18:36:14 +0000 (20:36 +0200)
* src/fileio.c (write_region): When auto-saving into the visited
file, unlock the file whenever we mark the buffer unmodified.
(Bug#25470)

src/fileio.c

index be52d0f3d0ecbec0ba8d989a04271ff239bb5c60..8c8cba9e49ce9ff0625ebed60ea02f13d8228776 100644 (file)
@@ -5142,19 +5142,26 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
   if (! ok)
     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)
     {
       SAVE_MODIFF = MODIFF;
       XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
       bset_filename (current_buffer, visit_file);
       update_mode_lines = 14;
+      if (auto_saving_into_visited_file)
+       unlock_file (lockname);
     }
   else if (quietly)
     {
-      if (auto_saving
-         && ! NILP (Fstring_equal (BVAR (current_buffer, filename),
-                                   BVAR (current_buffer, auto_save_file_name))))
-       SAVE_MODIFF = MODIFF;
+      if (auto_saving_into_visited_file)
+       {
+         SAVE_MODIFF = MODIFF;
+         unlock_file (lockname);
+       }
 
       return Qnil;
     }