]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (save-some-buffers-action-alist): Fix 'view-mode'.
authorJuri Linkov <juri@linkov.net>
Wed, 19 Mar 2025 19:09:10 +0000 (21:09 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 18:08:16 +0000 (19:08 +0100)
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).

(cherry picked from commit 7016d1c8e3c16e8bfb61ce8ef96d85490a00c2eb)

lisp/files.el

index b5cd20287f46052ad0adad612c76ab184a6d2d2a..771e55effadaa80952288addba98b4963ce2da16 100644 (file)
@@ -6355,7 +6355,10 @@ Before and after saving the buffer, this function runs
            "skip this buffer and mark it unmodified")
     (?\C-r
      ,(lambda (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)
@@ -6371,7 +6374,8 @@ Before and after saving the buffer, this function runs
              (require 'diff)            ;for diff-no-select.
              (let ((diffbuf (diff-no-select (buffer-file-name buf) buf
                                             nil 'noasync)))
-               (view-buffer diffbuf (lambda (_) (exit-recursive-edit)))
+               (switch-to-buffer diffbuf)
+               (view-mode-enter nil (lambda (_) (exit-recursive-edit)))
                (recursive-edit)))
            ;; Return nil to ask about BUF again.
            nil)