From f343f20b9449c14deceb9fed1a062687c1d52d38 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 9 Jun 2026 11:32:13 +0100 Subject: [PATCH] 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. --- doc/emacs/maintaining.texi | 11 ----------- etc/NEWS | 8 ++++++++ lisp/vc/vc-dir.el | 27 +++++++++++---------------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 785322118f9..e40ff8e3f26 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index ec440d927dc..5698c577445 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 6dd0cb69e81..45128aaf829 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -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))))))