From: Eli Zaretskii Date: Sat, 7 Nov 2020 10:29:41 +0000 (+0200) Subject: Don't leave lock files after 'replace-buffer-contents' X-Git-Tag: emacs-28.0.90~5215 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5867ddfbd721568005175bf6c725f7834b21ea4;p=emacs.git Don't leave lock files after 'replace-buffer-contents' * src/editfns.c (Freplace_buffer_contents): Unlock the buffer's file if no changes have been made. (Bug#44303) --- diff --git a/src/editfns.c b/src/editfns.c index ca6b8981ebf..aedab476146 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2117,6 +2117,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;