Re: master 268e055e051: Limit VC-Dir status process output processing
Sean Whitton <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Dmitry Gutov [11/Aug 6:55am +03] wrote:
> Hi Sean,
>
> Do you think we could change this improvement in a way that doesn't make
> the 'dir-status-files' backend actions coupled to VC-Dir?
>
> Some sort of setup that VC-Dir would do to its process buffer could lead
> to a more subtle approach.
>
> On 26/06/2026 16:53, Sean Whitton wrote:
>> (let ((files (vc-git-dir-status-state->files git-state))
>> - (allowed-exit 1))
>> + (allowed-exit 1)
>> + (limit vc-dir-process-output-limit))
>> (erase-buffer)
>> (pcase (vc-git-dir-status-state->stage git-state)
>> ('update-index
>> @@ -756,7 +760,10 @@ or an empty string if none."
>> ('diff-index
>> (git-cmd files "diff-index" "--relative" "-z" "-M" "HEAD" "--")))
>> (vc-run-delayed-success allowed-exit
>> - (vc-git-after-dir-status-stage git-state)))))
>> + (let ((vc-dir-process-output-limit limit))
>> + (vc-dir-maybe-narrow-and-show-more-button
>> + "(reported states may be incorrect)")
>> + (vc-git-after-dir-status-stage git-state))))))
>
> The way it's implemented here any third-party caller of dir-status-files
> (diff-hl-dired might be the main one) now has to learn of the unrelated
> variable from vc-dir.el.
>
> Originally: https://github.com/dgutov/diff-hl/pull/294
Sorry about that. How about this:
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index d75dce77493..d0711da91c8 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1801,7 +1801,10 @@ vc-dir-maybe-narrow-and-show-more-button
TEXT is passed on to `vc-dir-show-more-button'.
Called by VC backend `dir-status-files' implementations."
(when (and (natnump vc-dir-process-output-limit)
- (> (buffer-size) vc-dir-process-output-limit))
+ (> (buffer-size) vc-dir-process-output-limit)
+ vc-parent-buffer
+ (with-current-buffer vc-parent-buffer
+ (derived-mode-p 'vc-dir-mode)))
(narrow-to-region (point-min)
(save-excursion
(goto-char (+ (point-min)
--
Sean Whitton