From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#46701: [PATCH] small cleanups related to `unlock-buffer' Date: Sun, 21 Feb 2021 20:18:44 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5065"; mail-complaints-to="usenet@ciao.gmane.io" To: 46701@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 22 05:20:10 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 1lE2hd-0001Dw-VC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Feb 2021 05:20:09 +0100 Original-Received: from localhost ([::1]:33904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE2hd-0003ap-1B for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Feb 2021 23:20:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE2hW-0003ah-Jv for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 23:20:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lE2hW-0001x8-Cj for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 23:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lE2hW-0004Ds-7K for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 23:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Feb 2021 04:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46701 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161396754216149 (code B ref -1); Mon, 22 Feb 2021 04:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Feb 2021 04:19:02 +0000 Original-Received: from localhost ([127.0.0.1]:55361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lE2gX-0004CI-AU for submit@debbugs.gnu.org; Sun, 21 Feb 2021 23:19:01 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lE2gT-0004C8-FE for submit@debbugs.gnu.org; Sun, 21 Feb 2021 23:19:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE2gS-00039m-Va for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 23:18:57 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:54623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE2gP-0001Mw-P8 for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 23:18:56 -0500 Original-Received: from matts-mbp-2016.lan (24-113-169-116.wavecable.com [24.113.169.116]) (Authenticated sender: matt@rfc20.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id AB64B240003 for ; Mon, 22 Feb 2021 04:18:48 +0000 (UTC) Received-SPF: pass client-ip=217.70.178.230; envelope-from=matt@rfc20.org; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:200538 Archived-At: --=-=-= Content-Type: text/plain Two patches here, each removing code that has no effect or discernable purpose. I found these while working on a related bug. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Remove-unecessary-unlock-buffer-calls.patch Content-Description: Remove unecessary `unlock-buffer' calls. >From da42de650842b2d05da42bbbef9e61e8a747b1ff Mon Sep 17 00:00:00 2001 From: Matt Armstrong Date: Wed, 17 Feb 2021 16:47:18 -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. --- lisp/simple.el | 2 -- lisp/type-break.el | 1 - 2 files changed, 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 26710e6d53..4f5a9c5e83 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3041,8 +3041,6 @@ primitive-undo (and (consp time) (equal (list (car time) (cdr time)) (visited-file-modtime)))) - (when (fboundp 'unlock-buffer) - (unlock-buffer)) (set-buffer-modified-p nil))) ;; Element (nil PROP VAL BEG . END) is property change. (`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare)) diff --git a/lisp/type-break.el b/lisp/type-break.el index a6d5cd0170..984256d3ce 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -395,7 +395,6 @@ type-break-mode (with-current-buffer (find-file-noselect type-break-file-name 'nowarn) (set-buffer-modified-p nil) - (unlock-buffer) (kill-current-buffer)))))) (define-minor-mode type-break-mode-line-message-mode -- 2.30.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Remove-unecessary-buffer-file-name-let-bind.patch Content-Description: Remove unecessary let bind. >From 52c83a2d059ee2e3a22fd5c1e3eece13af169586 Mon Sep 17 00:00:00 2001 From: Matt Armstrong Date: Wed, 17 Feb 2021 16:36:39 -0800 Subject: [PATCH 2/4] Remove unecessary `buffer-file-name' let bind. * lisp/files.el (revert-buffer-insert-file-contents--default-function): Do not bind `buffer-file-name' around call to (unlock-buffer); it has no effect. --- lisp/files.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 68e883513c..962137f18c 100644 --- 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)) (widen) (let ((coding-system-for-read ;; Auto-saved file should be read by Emacs's -- 2.30.0 --=-=-=--