Fix reverting Rmail buffers
This bug happened because rmail.el relied on 'revert-buffer' to return non-nil when it succeeds to revert, but a recent change in 'revert-buffer' broke that promise in Emacs 29.1. * lisp/files.el (revert-buffer--default, revert-buffer): Doc fix. (revert-buffer): Return whatever 'revert-buffer-function' returns. (Bug#65071)
This commit is contained in:
parent
1e8322bb26
commit
adff72dd1d
1 changed files with 12 additions and 6 deletions
|
@ -6668,7 +6668,10 @@ This function binds `revert-buffer-in-progress-p' non-nil while it operates.
|
||||||
This function calls the function that `revert-buffer-function' specifies
|
This function calls the function that `revert-buffer-function' specifies
|
||||||
to do the work, with arguments IGNORE-AUTO and NOCONFIRM.
|
to do the work, with arguments IGNORE-AUTO and NOCONFIRM.
|
||||||
The default function runs the hooks `before-revert-hook' and
|
The default function runs the hooks `before-revert-hook' and
|
||||||
`after-revert-hook'
|
`after-revert-hook'.
|
||||||
|
Return value is whatever `revert-buffer-function' returns. For historical
|
||||||
|
reasons, that return value is non-nil when `revert-buffer-function'
|
||||||
|
succeeds in its job and returns non-nil.
|
||||||
|
|
||||||
Reverting a buffer will try to preserve markers in the buffer,
|
Reverting a buffer will try to preserve markers in the buffer,
|
||||||
but it cannot always preserve all of them. For better results,
|
but it cannot always preserve all of them. For better results,
|
||||||
|
@ -6685,17 +6688,20 @@ preserve markers and overlays, at the price of being slower."
|
||||||
(revert-buffer-preserve-modes preserve-modes)
|
(revert-buffer-preserve-modes preserve-modes)
|
||||||
(state (and (boundp 'read-only-mode--state)
|
(state (and (boundp 'read-only-mode--state)
|
||||||
(list read-only-mode--state))))
|
(list read-only-mode--state))))
|
||||||
(funcall (or revert-buffer-function #'revert-buffer--default)
|
;; Return whatever 'revert-buffer-function' returns.
|
||||||
|
(prog1 (funcall (or revert-buffer-function #'revert-buffer--default)
|
||||||
ignore-auto noconfirm)
|
ignore-auto noconfirm)
|
||||||
(when state
|
(when state
|
||||||
(setq buffer-read-only (car state))
|
(setq buffer-read-only (car state))
|
||||||
(setq-local read-only-mode--state (car state)))))
|
(setq-local read-only-mode--state (car state))))))
|
||||||
|
|
||||||
(defun revert-buffer--default (ignore-auto noconfirm)
|
(defun revert-buffer--default (ignore-auto noconfirm)
|
||||||
"Default function for `revert-buffer'.
|
"Default function for `revert-buffer'.
|
||||||
The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'.
|
The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'.
|
||||||
Runs the hooks `before-revert-hook' and `after-revert-hook' at the
|
Runs the hooks `before-revert-hook' and `after-revert-hook' at the
|
||||||
start and end.
|
start and end.
|
||||||
|
The function returns non-nil if it reverts the buffer; signals
|
||||||
|
an error if the buffer is not associated with a file.
|
||||||
|
|
||||||
Calls `revert-buffer-insert-file-contents-function' to reread the
|
Calls `revert-buffer-insert-file-contents-function' to reread the
|
||||||
contents of the visited file, with two arguments: the first is the file
|
contents of the visited file, with two arguments: the first is the file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue