From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#46701: [PATCH] small cleanups related to `unlock-buffer' Date: Mon, 22 Feb 2021 18:27:29 +0200 Message-ID: <831rd8vzim.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8117"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46701@debbugs.gnu.org To: Matt Armstrong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 22 17:31:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEE7D-0001zv-SQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Feb 2021 17:31:19 +0100 Original-Received: from localhost ([::1]:42302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEE7C-0006Eg-SN for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Feb 2021 11:31:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEE42-0002pG-MO for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2021 11:28:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEE42-00051C-EE for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2021 11:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lEE42-0001sw-8U for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2021 11:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Feb 2021 16:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46701 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46701-submit@debbugs.gnu.org id=B46701.16140112717229 (code B ref 46701); Mon, 22 Feb 2021 16:28:02 +0000 Original-Received: (at 46701) by debbugs.gnu.org; 22 Feb 2021 16:27:51 +0000 Original-Received: from localhost ([127.0.0.1]:57354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEE3q-0001sW-Ks for submit@debbugs.gnu.org; Mon, 22 Feb 2021 11:27:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEE3o-0001sC-6i for 46701@debbugs.gnu.org; Mon, 22 Feb 2021 11:27:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57596) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEE3h-0004zm-LZ; Mon, 22 Feb 2021 11:27:42 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1084 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lEE3g-0006KK-CK; Mon, 22 Feb 2021 11:27:41 -0500 In-Reply-To: (message from Matt Armstrong on Sun, 21 Feb 2021 20:18:44 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200597 Archived-At: > From: Matt Armstrong > Date: Sun, 21 Feb 2021 20:18:44 -0800 > > Subject: [PATCH 1/4] Remove unecessary (unlock-buffer) calls. > > * lisp/type-break.el (type-break-mode): Remove an (unlock-buffer) call > implied by (set-buffer-modified nil). > * lisp/simple.el (primitive-undo): ditto. My reading of the code is that the above is true only if inhibit-modification-hooks is nil. Otherwise, these calls are not no-ops. > --- a/lisp/files.el > +++ b/lisp/files.el > @@ -6234,11 +6234,8 @@ revert-buffer-insert-file-contents--default-function > "Cannot revert unreadable file %s") > file-name)) > (t > - ;; Bind buffer-file-name to nil > - ;; so that we don't try to lock the file. > - (let ((buffer-file-name nil)) > - (or auto-save-p > - (unlock-buffer))) > + (unless auto-save-p > + (unlock-buffer)) And here, I think we just forgot to update the Lisp code when unlock-buffer started to look at buffer-file-truename instead of buffer-file-name. But otherwise, I see no reason why we should remove the call to unlock-buffer; what did I miss? Thanks.