From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <8360lc8dha.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1484763785 27450 195.159.176.226 (18 Jan 2017 18:23:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 18 Jan 2017 18:23:05 +0000 (UTC) Cc: 25470@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 18 19:23:00 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTusd-0005Jd-TS for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jan 2017 19:22:44 +0100 Original-Received: from localhost ([::1]:43396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTusi-0007iW-N9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jan 2017 13:22:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTuO2-0007oP-FC for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2017 12:51:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTuNz-0006AO-Cf for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2017 12:51:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36758) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cTuNz-0006A9-9Z for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2017 12:51:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cTuNy-0008Ff-F3 for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2017 12:51:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jan 2017 17:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25470 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25470-submit@debbugs.gnu.org id=B25470.148476182331673 (code B ref 25470); Wed, 18 Jan 2017 17:51:02 +0000 Original-Received: (at 25470) by debbugs.gnu.org; 18 Jan 2017 17:50:23 +0000 Original-Received: from localhost ([127.0.0.1]:34957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTuNJ-0008El-Nc for submit@debbugs.gnu.org; Wed, 18 Jan 2017 12:50:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTuNH-0008EY-Ry for 25470@debbugs.gnu.org; Wed, 18 Jan 2017 12:50:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTuN9-00060D-Ik for 25470@debbugs.gnu.org; Wed, 18 Jan 2017 12:50:14 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTuN9-000608-GS; Wed, 18 Jan 2017 12:50:11 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2521 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cTuN8-0006Le-1Y; Wed, 18 Jan 2017 12:50:11 -0500 In-reply-to: (message from Philipp Stephani on Tue, 17 Jan 2017 20:43:33 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128207 Archived-At: > From: Philipp Stephani > 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; }