emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46701: closed ([PATCH] small cleanups related to `unlock-buffer')


From: GNU bug Tracking System
Subject: bug#46701: closed ([PATCH] small cleanups related to `unlock-buffer')
Date: Sat, 27 Feb 2021 14:26:01 +0000

Your message dated Sat, 27 Feb 2021 16:24:58 +0200
with message-id <83im6doaf9.fsf@gnu.org>
and subject line Re: bug#46701: [PATCH] small cleanups related to 
`unlock-buffer'
has caused the debbugs.gnu.org bug report #46701,
regarding [PATCH] small cleanups related to `unlock-buffer'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
46701: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46701
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] small cleanups related to `unlock-buffer' Date: Sun, 21 Feb 2021 20:18:44 -0800
Two patches here, each removing code that has no effect or discernable
purpose.  I found these while working on a related bug.

>From da42de650842b2d05da42bbbef9e61e8a747b1ff Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@rfc20.org>
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

>From 52c83a2d059ee2e3a22fd5c1e3eece13af169586 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@rfc20.org>
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


--- End Message ---
--- Begin Message --- Subject: Re: bug#46701: [PATCH] small cleanups related to `unlock-buffer' Date: Sat, 27 Feb 2021 16:24:58 +0200
> Date: Sat, 27 Feb 2021 16:22:26 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 46701@debbugs.gnu.org
> 
> > From: Matt Armstrong <matt@rfc20.org>
> > Cc: 46701@debbugs.gnu.org
> > Date: Mon, 22 Feb 2021 16:56:44 -0800
> > 
> > Thanks, good catch.  I think the change to type-break.el is probably
> > fine, but I will drop it for now.  In simple.el I just removed the
> > unecessary fboundp check (new patch attached).
> 
> Thanks, pushed to the master branch.

And with that, I'm closing this bug report.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]