From 1bdf9dd6cd4be7a903cb009fa54824de72b98762 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 6 Dec 2025 16:24:59 +0000 Subject: [PATCH] New user option vc-dir-show-outgoing-count * lisp/vc/vc-dir.el (vc-dir-show-outgoing-count): New defcustom. (vc-dir-headers): Use it. * doc/emacs/maintaining.texi (VC Directory Buffer): * etc/NEWS: Document it. --- doc/emacs/maintaining.texi | 11 +++++++++++ etc/NEWS | 1 + lisp/vc/vc-dir.el | 14 +++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 7286886db76..8e9fcc2cc23 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1528,6 +1528,17 @@ unpushed revisions"} where @var{N} is a number. You can click on this text to execute the @code{vc-log-outgoing} command (@pxref{VC Change Log}). +@vindex vc-dir-show-outgoing-count + Emacs tries to use cached information to determine the number of +unpushed revisions, but for some backends this isn't possible. In these +cases Emacs must occasionally fetch from the remote repository in order +to determine the count. If your connection to the remote repository is +slow then this may cause unacceptable slowdowns in refreshing the VC +Directory buffer. If this affects you, you can customize +@code{vc-dir-show-outgoing-count} to nil to disable the unpushed +revisions count altogether. You can also set this on a per-repository +basis using directory local variables (@pxref{Directory Variables}). + @node VC Directory Commands @subsubsection VC Directory Commands diff --git a/etc/NEWS b/etc/NEWS index f896241b24d..9f47cd57eac 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2551,6 +2551,7 @@ bindings: *** New display of outgoing revisions count in VC Directory. If there are outgoing revisions, VC Directory now includes a count of how many in its headers, to remind you to push them. +You can disable this by customizing vc-dir-show-outgoing-count to nil. +++ *** New user option 'vc-async-checkin' to enable async checkin operations. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 168260a6571..05b6019065e 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1339,6 +1339,17 @@ the *vc-dir* buffer. :doc "Local keymap for viewing outgoing revisions." "" #'vc-log-outgoing) +(defcustom vc-dir-show-outgoing-count t + "Whether to display the number of unpushed revisions in VC-Dir. +For some combinations of VC backends and remotes, determining how many +outgoing revisions there are is slow, because the backend must fetch +from the remote, and your connection to the remote is slow. Customize +this variable to nil to disable calculating the outgoing count and +therefore also disable the fetching." + :type 'boolean + :group 'vc + :version "31.1") + (defun vc-dir-headers (backend dir) "Display the headers in the *VC-Dir* buffer. It calls the `dir-extra-headers' backend method to display backend @@ -1351,7 +1362,8 @@ specific headers." 'face 'vc-dir-header-value) (vc-call-backend backend 'dir-extra-headers dir) "\n" - (and-let* ((count (ignore-errors (vc--count-outgoing backend))) + (and-let* (vc-dir-show-outgoing-count + (count (ignore-errors (vc--count-outgoing backend))) (_ (plusp count))) (concat (propertize "Outgoing : " 'face 'vc-dir-header)