[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46701: [PATCH] small cleanups related to `unlock-buffer'
From: |
Eli Zaretskii |
Subject: |
bug#46701: [PATCH] small cleanups related to `unlock-buffer' |
Date: |
Mon, 22 Feb 2021 18:27:29 +0200 |
> From: Matt Armstrong <matt@rfc20.org>
> 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.