From: Matt Armstrong <matt@rfc20.org>
To: 46701@debbugs.gnu.org
Subject: bug#46701: [PATCH] small cleanups related to `unlock-buffer'
Date: Sun, 21 Feb 2021 20:18:44 -0800 [thread overview]
Message-ID: <m2y2fgybtn.fsf@matts-mbp-2016.lan> (raw)
[-- Attachment #1: Type: text/plain, Size: 128 bytes --]
Two patches here, each removing code that has no effect or discernable
purpose. I found these while working on a related bug.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Remove unecessary `unlock-buffer' calls. --]
[-- Type: text/x-patch, Size: 1500 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Remove unecessary let bind. --]
[-- Type: text/x-patch, Size: 1063 bytes --]
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
next reply other threads:[~2021-02-22 4:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 4:18 Matt Armstrong [this message]
2021-02-22 16:27 ` bug#46701: [PATCH] small cleanups related to `unlock-buffer' Eli Zaretskii
2021-02-23 0:56 ` Matt Armstrong
2021-02-26 0:45 ` Stefan Kangas
2021-02-27 14:22 ` Eli Zaretskii
2021-02-27 14:24 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2y2fgybtn.fsf@matts-mbp-2016.lan \
--to=matt@rfc20.org \
--cc=46701@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.