From 7016d1c8e3c16e8bfb61ce8ef96d85490a00c2eb Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 19 Mar 2025 21:09:10 +0200 Subject: [PATCH] * lisp/files.el (save-some-buffers-action-alist): Fix 'view-mode'. Use 'view-mode-enter' instead of 'view-buffer' to ignore the 'special' mode-class that prevents some modes from binding 'q' to 'exit-action' that should call 'exit-recursive-edit' (bug#76745). --- lisp/files.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index f85021f0d69..461960d6f2b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6288,7 +6288,10 @@ Before and after saving the buffer, this function runs (if (not enable-recursive-minibuffers) (progn (display-buffer buf) (setq other-window-scroll-buffer buf)) - (view-buffer buf (lambda (_) (exit-recursive-edit))) + ;; Like 'view-buffer' but ignore 'special' mode-class + ;; because 'q' should call 'exit-action' in any case: + (switch-to-buffer buf) + (view-mode-enter nil (lambda (_) (exit-recursive-edit))) (recursive-edit)) ;; Return nil to ask about BUF again. nil) @@ -6307,7 +6310,10 @@ Before and after saving the buffer, this function runs (if (not enable-recursive-minibuffers) (progn (display-buffer diffbuf) (setq other-window-scroll-buffer diffbuf)) - (view-buffer diffbuf (lambda (_) (exit-recursive-edit))) + ;; Like 'view-buffer' but ignore 'special' mode-class + ;; because 'q' should call 'exit-action' in any case: + (switch-to-buffer diffbuf) + (view-mode-enter nil (lambda (_) (exit-recursive-edit))) (recursive-edit)))) ;; Return nil to ask about BUF again. nil)