Mark vc-dir-show-outgoing-count obsolete

* lisp/vc/vc-dir.el (vc-dir-show-outgoing-count): Mark obsolete.
(vc-dir-async-header-values): Use a list of cons.
(vc-dir-headers, vc-dir-refresh): Update for new
vc-dir-async-header-values structure.
* doc/emacs/maintaining.texi (VC Directory Buffer): Delete
mention of the variable.
* etc/NEWS: Announce the obsoletion.
This commit is contained in:
Sean Whitton 2026-06-09 11:32:13 +01:00
parent a0dc061fa2
commit f343f20b94
3 changed files with 19 additions and 27 deletions

View file

@ -1599,17 +1599,6 @@ unpushed revisions"} where @var{N} is a number. You can click on this
text to execute the @code{vc-root-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 @code{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

View file

@ -80,6 +80,14 @@ is a symbolic link to 'target/', then 'C-x v d link/ RET' is the same as
the project root is a symbolic link, 'C-x p v' first finds the truename
of the directory named by that link, and then opens VC-Dir there.
** VC
+++
*** VC-Dir outgoing revisions count is now asynchronous.
This means it won't get in your way even if it's slow for your
repository. As such, the 'vc-dir-show-outgoing-count' option is now
obsolete.
* New Modes and Packages in Emacs 32.1

View file

@ -1414,15 +1414,14 @@ the *vc-dir* buffer.
(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."
This variable was for when the number of unpushed revisions was counted
synchronously. As that is now done asynchronously, this toggle is no
longer needed."
:type 'boolean
:safe #'booleanp
:group 'vc
:version "31.1")
(make-obsolete-variable 'vc-dir-show-outgoing-count nil "32.1")
(defvar log-view-message-re)
@ -1471,12 +1470,9 @@ uses OVERLAY."
(kill-buffer buf))))))
(defvar-local vc-dir-async-header-values
'((vc-dir-show-outgoing-count "Outgoing" vc-dir--count-outgoing))
'(("Outgoing" . vc-dir--count-outgoing))
"List of specifications for asynchronously computed VC-Dir header values.
Each element is a list (VAR HEADER FUN) where
- VAR is the name of a variable.
If the variable's value is nil, the async header will not be included.
This is so the user can turn off including the header.
Each element is a pair (HEADER . FUN) where
- HEADER is a string label for the header in the VC-Dir buffer.
- FUN is a function of two arguments (BACKEND OVERLAY) that starts the
asynchronous computation of the header's value. BACKEND is the VC
@ -1507,11 +1503,10 @@ specific headers."
'face 'vc-dir-header-value)
(vc-call-backend backend 'dir-extra-headers dir)
"\n"
(mapconcat (pcase-lambda (`(,var ,header ,_))
(and (symbol-value var)
(concat (propertize (format "%-11s: " header)
'face 'vc-dir-header)
"\n")))
(mapconcat (pcase-lambda (`(,header . ,_))
(concat (propertize (format "%-11s: " header)
'face 'vc-dir-header)
"\n"))
vc-dir-async-header-values)))
(defun vc-dir-refresh-files (files)
@ -1605,7 +1600,7 @@ Throw an error if another update process is in progress."
(delete-overlay overlay))
;; Set up new async header overlays.
(save-excursion
(pcase-dolist (`(,_ ,field ,fun) vc-dir-async-header-values)
(pcase-dolist (`(,field . ,fun) vc-dir-async-header-values)
(goto-char (point-min))
(when (re-search-forward (format "^%s\\s-" field) nil t)
(funcall fun backend (make-overlay (pos-eol) (pos-eol))))))