GNU bug report logs -
#62749
28.2; add-log-current-defun doesn't clean up its temporary buffers
Previous Next
To reply to this bug, email your comments to 62749 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Mon, 10 Apr 2023 12:12:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleksandr Gavenko <gavenkoa <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 10 Apr 2023 12:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In GNU Emacs 28.2 (build 1, x86_64-pc-cygwin)
of 2022-09-16 built on fv-az140-985
Repository revision: 70134aa8264ded36d80248204b2ba43ae3d8f599
Whenever I open vc-diff buffer by "d" (log-view-diff) to read repository
history from "C-x v L" (vc-print-root-log) Emacs opens all files referenced by
diff.
The diff might be very big so:
* I end with lots of opened files that I need eventually close.
* Emacs pollutes recentf history - I don't want robotically opened file mixed
with human opened files.
* Cygwin is slow (especially under antivirus supervision) file opening delays
Emacs for many seconds.
Initially I asked for help in Emacs 27.1:
https://emacs.stackexchange.com/questions/61760/lags-when-navigating-vc-root-diff-buffer/
and found workaround with:
(setq diff-font-lock-syntax nil)
But with Emacs v28.2 it doesn't work, I asked for help once more:
https://emacs.stackexchange.com/questions/76728/modern-emacs-keeps-opening-related-file-from-vc-diff-buffer
--
http://defun.work/
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Mon, 10 Apr 2023 12:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 62749 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Seems the problem is related to syntax highlighting parsers in diffs.
I don't need syntax highlighting at the cost of slowness and polluted
recentf history.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Mon, 10 Apr 2023 22:24:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 62749 <at> debbugs.gnu.org (full text, mbox):
Hi! Thanks for the report.
On 10/04/2023 15:11, Oleksandr Gavenko wrote:
> In GNU Emacs 28.2 (build 1, x86_64-pc-cygwin)
> of 2022-09-16 built on fv-az140-985
> Repository revision: 70134aa8264ded36d80248204b2ba43ae3d8f599
>
> Whenever I open vc-diff buffer by "d" (log-view-diff) to read repository
> history from "C-x v L" (vc-print-root-log) Emacs opens all files referenced by
> diff.
>
> The diff might be very big so:
>
> * I end with lots of opened files that I need eventually close.
> * Emacs pollutes recentf history - I don't want robotically opened file mixed
> with human opened files.
> * Cygwin is slow (especially under antivirus supervision) file opening delays
> Emacs for many seconds.
>
> Initially I asked for help in Emacs 27.1:
>
> https://emacs.stackexchange.com/questions/61760/lags-when-navigating-vc-root-diff-buffer/
>
> and found workaround with:
>
> (setq diff-font-lock-syntax nil)
This workaround should help, in particular to improve performance under
Cygwin.
The thing about opened files is quite odd, though:
diff-syntax-fontify-hunk does not visit any new files. It either uses an
existing buffer, or fetches file contents using insert-file-contents, or
calls vc-find-revision-no-save which, again, inserts the previous'
revision file contents into the provided buffer, without visiting a file.
Perhaps you could edebug diff-syntax-fontify-hunk to find the exact
place where a file is visited (and added to recentf), if that indeed
happens.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Sun, 14 May 2023 11:01:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 62749 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
After bisecting my long .emacs config I pinpointed the culprit:
(which-func-mode 1)
During the movement through a diff buffer this mode loads corresponding
files:
if the cursor reaches a new hunk - the corresponding file is opened ((
This is done one by one file while I scroll down with the cursor.
Removing the line significantly improved performance during scromming in VC
diff buffer in Cygwin and no more new files opened!
I think which-function-mode is broken for diff-mode, the workaround for
those who wants this mode is to deal with:
(defcustom which-func-modes t
;; '(emacs-lisp-mode c-mode c++-mode objc-mode perl-mode cperl-mode
python-mode
;; makefile-mode sh-mode fortran-mode f90-mode ada-mode
;; diff-mode)
"List of major modes for which Which Function mode should be used.
For other modes it is disabled. If this is equal to t,
then Which Function mode is enabled in any major mode that supports it."
What are the next actions?
On Tue, Apr 11, 2023 at 1:23 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> Hi! Thanks for the report.
>
> On 10/04/2023 15:11, Oleksandr Gavenko wrote:
> > In GNU Emacs 28.2 (build 1, x86_64-pc-cygwin)
> > of 2022-09-16 built on fv-az140-985
> > Repository revision: 70134aa8264ded36d80248204b2ba43ae3d8f599
> >
> > Whenever I open vc-diff buffer by "d" (log-view-diff) to read repository
> > history from "C-x v L" (vc-print-root-log) Emacs opens all files
> referenced by
> > diff.
> >
> > The diff might be very big so:
> >
> > * I end with lots of opened files that I need eventually close.
> > * Emacs pollutes recentf history - I don't want robotically opened file
> mixed
> > with human opened files.
> > * Cygwin is slow (especially under antivirus supervision) file opening
> delays
> > Emacs for many seconds.
> >
> > Initially I asked for help in Emacs 27.1:
> >
> >
> https://emacs.stackexchange.com/questions/61760/lags-when-navigating-vc-root-diff-buffer/
> >
> > and found workaround with:
> >
> > (setq diff-font-lock-syntax nil)
>
> This workaround should help, in particular to improve performance under
> Cygwin.
>
> The thing about opened files is quite odd, though:
> diff-syntax-fontify-hunk does not visit any new files. It either uses an
> existing buffer, or fetches file contents using insert-file-contents, or
> calls vc-find-revision-no-save which, again, inserts the previous'
> revision file contents into the provided buffer, without visiting a file.
>
> Perhaps you could edebug diff-syntax-fontify-hunk to find the exact
> place where a file is visited (and added to recentf), if that indeed
> happens.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Mon, 15 May 2023 17:06:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 62749 <at> debbugs.gnu.org (full text, mbox):
> After bisecting my long .emacs config I pinpointed the culprit:
>
> (which-func-mode 1)
>
> During the movement through a diff buffer this mode loads corresponding
> files:
>
> if the cursor reaches a new hunk - the corresponding file is opened ((
>
> This is done one by one file while I scroll down with the cursor.
>
> Removing the line significantly improved performance during scromming in VC
> diff buffer in Cygwin and no more new files opened!
This is an interesting problem, I can reproduce it by
'M-x which-function-mode'.
> I think which-function-mode is broken for diff-mode, the workaround for
> those who wants this mode is to deal with:
>
> (defcustom which-func-modes t
> ;; '(emacs-lisp-mode c-mode c++-mode objc-mode perl-mode cperl-mode python-mode
> ;; makefile-mode sh-mode fortran-mode f90-mode ada-mode
> ;; diff-mode)
> "List of major modes for which Which Function mode should be used.
> For other modes it is disabled. If this is equal to t,
> then Which Function mode is enabled in any major mode that supports it."
>
> What are the next actions?
Maybe 'diff-syntax-fontify' could have a similar list of minor modes
that should be ignored. Then such a list should at least contain
'which-func-mode' by default.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Tue, 16 May 2023 11:47:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 62749 <at> debbugs.gnu.org (full text, mbox):
On 15/05/2023 19:46, Juri Linkov wrote:
>> After bisecting my long .emacs config I pinpointed the culprit:
>>
>> (which-func-mode 1)
>>
>> During the movement through a diff buffer this mode loads corresponding
>> files:
>>
>> if the cursor reaches a new hunk - the corresponding file is opened ((
>>
>> This is done one by one file while I scroll down with the cursor.
>>
>> Removing the line significantly improved performance during scromming in VC
>> diff buffer in Cygwin and no more new files opened!
> This is an interesting problem, I can reproduce it by
> 'M-x which-function-mode'.
>
>> I think which-function-mode is broken for diff-mode, the workaround for
>> those who wants this mode is to deal with:
>>
>> (defcustom which-func-modes t
>> ;; '(emacs-lisp-mode c-mode c++-mode objc-mode perl-mode cperl-mode python-mode
>> ;; makefile-mode sh-mode fortran-mode f90-mode ada-mode
>> ;; diff-mode)
>> "List of major modes for which Which Function mode should be used.
>> For other modes it is disabled. If this is equal to t,
>> then Which Function mode is enabled in any major mode that supports it."
>>
>> What are the next actions?
> Maybe 'diff-syntax-fontify' could have a similar list of minor modes
> that should be ignored. Then such a list should at least contain
> 'which-func-mode' by default.
Do you mean that it's not feasible to fix the behavior when
which-func-mode is enabled?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Tue, 16 May 2023 16:53:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 62749 <at> debbugs.gnu.org (full text, mbox):
>>> After bisecting my long .emacs config I pinpointed the culprit:
>>>
>>> (which-func-mode 1)
>>
>> Maybe 'diff-syntax-fontify' could have a similar list of minor modes
>> that should be ignored. Then such a list should at least contain
>> 'which-func-mode' by default.
>
> Do you mean that it's not feasible to fix the behavior when which-func-mode
> is enabled?
After debugging I realized it's not related to diff-font-lock-syntax.
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.
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Tue, 11 Mar 2025 11:54:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 62749 <at> debbugs.gnu.org (full text, mbox):
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
Changed bug title to '28.2; Disabling minor modes in diff-mode hunk temporary buffers' from '28.2; Emacs keeps opening related file from vc-diff buffer'
Request was from
Sean Whitton <spwhitton <at> spwhitton.name>
to
control <at> debbugs.gnu.org
.
(Tue, 11 Mar 2025 11:55:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Tue, 11 Mar 2025 17:24:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 62749 <at> debbugs.gnu.org (full text, mbox):
>> 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 ?
This was already fixed long ago: there is '(delay-mode-hooks (set-auto-mode))'
in 'diff-syntax-fontify-props'.
>> 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?
'which-function' uses 'add-log-current-defun' that creates the buffers
for files it visits, but never kills these temporary buffers afterwards.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62749
; Package
emacs
.
(Wed, 12 Mar 2025 07:18:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 62749 <at> debbugs.gnu.org (full text, mbox):
retitle 62749 28.2; add-log-current-defun doesn't clean up its temporary buffers
thanks
On Tue 11 Mar 2025 at 07:19pm +02, Juri Linkov wrote:
> This was already fixed long ago: there is '(delay-mode-hooks (set-auto-mode))'
> in 'diff-syntax-fontify-props'.
Oh, great.
>>> 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?
>
> 'which-function' uses 'add-log-current-defun' that creates the buffers
> for files it visits, but never kills these temporary buffers afterwards.
Okay, retitling this bug, then. Thanks.
--
Sean Whitton
Changed bug title to '28.2; add-log-current-defun doesn't clean up its temporary buffers' from '28.2; Disabling minor modes in diff-mode hunk temporary buffers'
Request was from
Sean Whitton <spwhitton <at> spwhitton.name>
to
control <at> debbugs.gnu.org
.
(Wed, 12 Mar 2025 07:18:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.