GNU bug report logs - #25470
26.0.50; Lock files not removed when auto-save-visited-file-name is t

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Tue, 17 Jan 2017 19:44:01 UTC

Severity: normal

Found in version 26.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 25470 <at> debbugs.gnu.org
Subject: bug#25470: 26.0.50; Lock files not removed when auto-save-visited-file-name is t
Date: Wed, 18 Jan 2017 19:49:53 +0200
> From: Philipp Stephani <p.stephani2 <at> gmail.com>
> Date: Tue, 17 Jan 2017 20:43:33 +0100
> 
> 
> Customize auto-save-visited-file to t, then edit a buffer and wait until
> it's auto-saved.  Even after auto-saving the lock file (.#) is still
> present.  It should be removed after a successful auto-save.

Does the patch below give good results?

diff --git a/src/fileio.c b/src/fileio.c
index be52d0f..8c8cba9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -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;
     }




This bug report was last modified 8 years and 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.