bug#81527: Prevent vc-hg-diff from blocking when called with non-nil ASYNC argument

Sean Whitton <[email protected]> Mon, 03 Aug 2026 10:39:23 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Version: 32.1

Aaron Zeng [31/Jul  3:47pm -04] wrote:
> At my site we use the diff-hl package to show inline diffs and
> highlight changed parts of a visited file in the margin.  The
> diff-hl-update-async=t option makes updates call the VC `diff' backend
> function with a non-nil ASYNC argument, which attempts to alleviate
> most of the undesirable pauses during typing that this might otherwise
> cause.
>
> However, I noticed that vc-hg-diff can sometimes cause a brief
> noticeable pause during this background update if
> vc-hg-working-revision takes some time to complete.  I believe calling
> this function is actually not necessary, so the second patch removes
> that call.  This changes the arguments passed to "hg diff" slightly if
> OLDVERS is "." or the actual hash of the working revision, but should
> not change behavior.

This code goes all the way back to when vc-hg-diff was first introduced.
I think you're right that it's not necessary.  It meant that we called
'hg diff' instead of 'hg diff -r [some reference to of the working rev]'
but these two commands should always produce the same result.

I've opted to install that patch on master.

Btw, your commit message had an overly long line.  I've reformatted it.

> The first patch contains a small bugfix for a discrepancy between
> vc-hg-diff and the `diff' VC backend function's description in the
> vc.el Commentary, which I happened to notice as I was drafting my
> original patch.  (I compared with vc-git-diff).

Thanks for figuring that out, installed on emacs-31.

-- 
Sean Whitton