Subject: Re: bug#62749: 28.2; Disabling minor modes in diff-mode hunk temporary buffers

From: Sean Whitton <[email-masked]>
Date: Tue, 11 Mar 2025 19:53:26 +0800

retitle 62749 28.2; Disabling minor modes in diff-mode hunk temporary buffers
thanks

On Tue 16 May 2023 at 07:44pm +03, Juri Linkov wrote:

> The problem is that 'which-func-mode' is enabled in diff-mode.
> 'which-function' calls 'add-log-current-defun' that calls
> 'add-log-current-defun-function' that is 'diff-current-defun'
> in diff-mode.  Finally, 'diff-find-source-location' visits
> the source files without killing them afterwards.

In commit 53977213522 Stefan K. fixed a similar sort of problem for
Paredit users.  Specifically, when trying to use C-c C-w in a Log Edit
buffer, diff-add-log-current-defuns tries to enable Paredit in its
*diff-other-text* temporary buffers.

Paredit calls check-parens, which fails because it's just a small
portion of the file and so the parens aren't balanced.
This signalled a user-error which interrupts the whole operation.

What is similar in these two cases is that diff-mode code is setting up
temporary buffers for hunks in which only the major mode matters, but
there are various possible minor modes that could get in the way because
they expect to be enabled in buffers visiting whole files.

So I think this your problem here, Juri, might be fixable in a similar
way to 53977213522, by using delay-mode-hooks ?

> I guess this is related to another annoying bug: after every commit need
> to spend much time killing all buffers created by the commit command.

I'm not sure what you're referring to here, could you expand?

-- 
Sean Whitton