GNU bug report logs - #76745
31.0.50; ?d action in save-some-buffers-action-alist to view diff does not work

Previous Next

Package: emacs;

Reported by: StrawberryTea <look <at> strawberrytea.xyz>

Date: Tue, 4 Mar 2025 18:49:03 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: StrawberryTea <look <at> strawberrytea.xyz>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76745 <at> debbugs.gnu.org
Subject: bug#76745: 31.0.50; ?d action in save-some-buffers-action-alist to view diff does not work
Date: Wed, 12 Mar 2025 21:58:33 -0400
Juri Linkov <juri <at> linkov.net> writes:
Well, I agree that for save-some-buffers we should enter view-mode. But
I don't see why view-mode should be disabled for diff-mode in general.
Diff-mode is a major mode that is used for viewing diffs, it is not
specifically for save-some-buffers.

The key issue here is that diff-mode serves multiple purposes:

1. Sometimes diff buffers are purely for viewing (like in
   save-some-buffers), where the primary user need is quick navigation
   and an easy way to exit

2. Other times, users need to actively work with diff content -
   navigating by sections, copying hunks, applying patches, etc.

Disabling view-mode entirely for diff-mode (as in #75993) prioritizes
the second use case at the expense of the first. But I believe a better
approach is to maintain both capabilities and let users or calling
functions decide which mode is appropriate for their context.

For viewing-only situations like save-some-buffers, view-mode provides
valuable functionality - particularly the quick navigation keys and the
critical ability to exit with 'q' which triggers exit-recursive-edit in
this context.

Rather than disabling view-mode completely for diff-mode, we should
investigate why view-mode is being activated when you do not intend it
to be. If there are specific situations where view-mode interferes with
diff-mode functionality, we should consider either disabling view-mode
in those specific contexts or exiting view-mode in those situations,
rather than making a global change that affects all diff-mode usage.
>> Hello. I have found that the fix from #75993 breaks the ?d action in
>> save-some-buffers-action-alist. The reason is that since we are not
>> entering view-mode after #75993, when we type ?q to quit the diff
>> window, we are not calling exit-recursive-edit to return to the
>> save-some-buffers queries.
>>
>> So on one hand, we want to scroll through the diff easily to decide
>> whether to save the buffer or not. But on the other hand, we want to
>> navigate by the diff sections and copy hunks. To me, this is a model
>> editing situation. The user should exit view mode to perform diff
>> commands instead of disabling view-mode for diffs altogether like in
>> #75993.
>>
>> But anyway, I propose that we revert #75993.
>
> Reverting will again steal single-letter keys from diff-mode to view-mode.
>
> Why not change only 'save-some-buffers-action-alist' and replace
>
>   (view-buffer diffbuf (lambda (_) (exit-recursive-edit)))
>
> with
>
>   (with-current-buffer diffbuf (view-mode-enter nil (lambda (_) (exit-recursive-edit))))




This bug report was last modified 63 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.