]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't leave lock files after 'replace-buffer-contents'
authorEli Zaretskii <eliz@gnu.org>
Sat, 7 Nov 2020 10:29:41 +0000 (12:29 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 Nov 2020 13:24:15 +0000 (15:24 +0200)
* src/editfns.c (Freplace_buffer_contents): Unlock the buffer's
file if no changes have been made.  (Bug#44303)

(cherry picked from commit a5867ddfbd721568005175bf6c725f7834b21ea4)

src/editfns.c

index f660513b2a490295038f16e0ab2ac36c3d48a3a7..fb420dac7fada931cf083735f729018114ebc2f1 100644 (file)
@@ -2145,6 +2145,13 @@ nil.  */)
     {
       signal_after_change (BEGV, size_a, ZV - BEGV);
       update_compositions (BEGV, ZV, CHECK_INSIDE);
+      /* We've locked the buffer's file above in
+        prepare_to_modify_buffer; if the buffer is unchanged at this
+        point, i.e. no insertions or deletions have been made, unlock
+        the file now.  */
+      if (SAVE_MODIFF == MODIFF
+         && STRINGP (BVAR (a, file_truename)))
+       unlock_file (BVAR (a, file_truename));
     }
 
   return Qt;