2

Question

Does a "lazy" or "asynchronous" vc mode exist?

Background

Emacs vc mode is designed on the assumption that the version control backend is fast. Much of the core vc features wants the version control status information immediately. For example, vc-refresh-state is run from find-file-hooks, which sets up buffer local state with respect to the vc backend, synchronously.

There are places that do issue commands asynchronously. E.g. I do see vc-do-async-command, and it is called for some operations, just not the ones that matter most to me (e.g. from find-file-hooks).

My negative experience

This is a problem on slow file systems or if the version control system is not fast. For example, with global-auto-revert-mode on, in a large Mercurial client, where any given hg status takes 0.3 seconds, changing the current branch can take quite a long time if I have a lot of buffers open.

If I disable vc mode with something like vc-ignore-dir-regexp I lose all vc commands. I would gladly give up small niceties like up-to-date version control information in the mode line, if it got me performance.

Lazy approach

A "lazy" vc mode might delay all interaction with the version control system until the user explicitly interacts with a vc command. Commands such as vc-diff would first determine the vc backend, if needed, and then do the operation. This would be functional equivalent of having no vc mode at all, and simply switching to a shell and running commands like foo diff, except that it would still have the nice Emacs veneer. In some respects, this might end up being a "vc mode lite".

Asynchronous approach

An "asynchronous" vc mode would be more delicate to design and implement, but essentially run all external commands on an asynchronous queue. This way, a large number of files could be auto reverted without blocking Emacs.

  • 1
    For mercurial repositories i made vc backend that uses hg command server. It's much faster to communicate with persistent hg process rather then invoke hg on every command. It's not answer your question but it may speed up you work with mercurial repos. – muffinmad Dec 11 '18 at 12:47
  • Interesting. And if on a unix-ish system, mercurial-scm.org/wiki/CHg may be useful too. – MattArmstrong Dec 14 '18 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.