aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-08-06 09:33:44 +0300
committerEli Zaretskii2023-08-06 09:33:44 +0300
commitadff72dd1d2064101f49d7c87582fc434bbc15c3 (patch)
tree73dbe8a28e1749a5a384336cd1667de12c6b9d8f
parent1e8322bb26e4945de460780168732250bbd083d0 (diff)
downloademacs-adff72dd1d2064101f49d7c87582fc434bbc15c3.tar.gz
emacs-adff72dd1d2064101f49d7c87582fc434bbc15c3.zip
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)
-rw-r--r--lisp/files.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index d325729bf4d..29d109ab385 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6668,7 +6668,10 @@ This function binds `revert-buffer-in-progress-p' non-nil while it operates.
6668This function calls the function that `revert-buffer-function' specifies 6668This function calls the function that `revert-buffer-function' specifies
6669to do the work, with arguments IGNORE-AUTO and NOCONFIRM. 6669to do the work, with arguments IGNORE-AUTO and NOCONFIRM.
6670The default function runs the hooks `before-revert-hook' and 6670The default function runs the hooks `before-revert-hook' and
6671`after-revert-hook' 6671`after-revert-hook'.
6672Return value is whatever `revert-buffer-function' returns. For historical
6673reasons, that return value is non-nil when `revert-buffer-function'
6674succeeds in its job and returns non-nil.
6672 6675
6673Reverting a buffer will try to preserve markers in the buffer, 6676Reverting a buffer will try to preserve markers in the buffer,
6674but it cannot always preserve all of them. For better results, 6677but it cannot always preserve all of them. For better results,
@@ -6685,17 +6688,20 @@ preserve markers and overlays, at the price of being slower."
6685 (revert-buffer-preserve-modes preserve-modes) 6688 (revert-buffer-preserve-modes preserve-modes)
6686 (state (and (boundp 'read-only-mode--state) 6689 (state (and (boundp 'read-only-mode--state)
6687 (list read-only-mode--state)))) 6690 (list read-only-mode--state))))
6688 (funcall (or revert-buffer-function #'revert-buffer--default) 6691 ;; Return whatever 'revert-buffer-function' returns.
6689 ignore-auto noconfirm) 6692 (prog1 (funcall (or revert-buffer-function #'revert-buffer--default)
6690 (when state 6693 ignore-auto noconfirm)
6691 (setq buffer-read-only (car state)) 6694 (when state
6692 (setq-local read-only-mode--state (car state))))) 6695 (setq buffer-read-only (car state))
6696 (setq-local read-only-mode--state (car state))))))
6693 6697
6694(defun revert-buffer--default (ignore-auto noconfirm) 6698(defun revert-buffer--default (ignore-auto noconfirm)
6695 "Default function for `revert-buffer'. 6699 "Default function for `revert-buffer'.
6696The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'. 6700The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'.
6697Runs the hooks `before-revert-hook' and `after-revert-hook' at the 6701Runs the hooks `before-revert-hook' and `after-revert-hook' at the
6698start and end. 6702start and end.
6703The function returns non-nil if it reverts the buffer; signals
6704an error if the buffer is not associated with a file.
6699 6705
6700Calls `revert-buffer-insert-file-contents-function' to reread the 6706Calls `revert-buffer-insert-file-contents-function' to reread the
6701contents of the visited file, with two arguments: the first is the file 6707contents of the visited file, with two arguments: the first is the file