diff options
| author | Eli Zaretskii | 2023-08-06 09:33:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-08-06 09:33:44 +0300 |
| commit | adff72dd1d2064101f49d7c87582fc434bbc15c3 (patch) | |
| tree | 73dbe8a28e1749a5a384336cd1667de12c6b9d8f | |
| parent | 1e8322bb26e4945de460780168732250bbd083d0 (diff) | |
| download | emacs-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.el | 18 |
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. | |||
| 6668 | This function calls the function that `revert-buffer-function' specifies | 6668 | This function calls the function that `revert-buffer-function' specifies |
| 6669 | to do the work, with arguments IGNORE-AUTO and NOCONFIRM. | 6669 | to do the work, with arguments IGNORE-AUTO and NOCONFIRM. |
| 6670 | The default function runs the hooks `before-revert-hook' and | 6670 | The default function runs the hooks `before-revert-hook' and |
| 6671 | `after-revert-hook' | 6671 | `after-revert-hook'. |
| 6672 | Return value is whatever `revert-buffer-function' returns. For historical | ||
| 6673 | reasons, that return value is non-nil when `revert-buffer-function' | ||
| 6674 | succeeds in its job and returns non-nil. | ||
| 6672 | 6675 | ||
| 6673 | Reverting a buffer will try to preserve markers in the buffer, | 6676 | Reverting a buffer will try to preserve markers in the buffer, |
| 6674 | but it cannot always preserve all of them. For better results, | 6677 | 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." | |||
| 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'. |
| 6696 | The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'. | 6700 | The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'. |
| 6697 | Runs the hooks `before-revert-hook' and `after-revert-hook' at the | 6701 | Runs the hooks `before-revert-hook' and `after-revert-hook' at the |
| 6698 | start and end. | 6702 | start and end. |
| 6703 | The function returns non-nil if it reverts the buffer; signals | ||
| 6704 | an error if the buffer is not associated with a file. | ||
| 6699 | 6705 | ||
| 6700 | Calls `revert-buffer-insert-file-contents-function' to reread the | 6706 | Calls `revert-buffer-insert-file-contents-function' to reread the |
| 6701 | contents of the visited file, with two arguments: the first is the file | 6707 | contents of the visited file, with two arguments: the first is the file |