From: Eli Zaretskii Date: Sun, 6 Aug 2023 06:33:44 +0000 (+0300) Subject: Fix reverting Rmail buffers X-Git-Tag: emacs-29.1.90~251 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=adff72dd1d2064101f49d7c87582fc434bbc15c3;p=emacs.git 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) --- 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. This function calls the function that `revert-buffer-function' specifies to do the work, with arguments IGNORE-AUTO and NOCONFIRM. 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, 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) (state (and (boundp 'read-only-mode--state) (list read-only-mode--state)))) - (funcall (or revert-buffer-function #'revert-buffer--default) - ignore-auto noconfirm) - (when state - (setq buffer-read-only (car state)) - (setq-local read-only-mode--state (car state))))) + ;; Return whatever 'revert-buffer-function' returns. + (prog1 (funcall (or revert-buffer-function #'revert-buffer--default) + ignore-auto noconfirm) + (when state + (setq buffer-read-only (car state)) + (setq-local read-only-mode--state (car state)))))) (defun revert-buffer--default (ignore-auto noconfirm) "Default function 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 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 contents of the visited file, with two arguments: the first is the file