[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A project-files implementation for Git projects

From: Stefan Monnier
Subject: Re: A project-files implementation for Git projects
Date: Tue, 10 Sep 2019 08:56:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Would that mean that I would need to add functions
>   vc-git-list-files (using: git ls-files)
>   vc-hg-list-files (using: hg files)
>   ...
> for all backends which support listing tracked files?

For all backends for which you want to implement the feature yes.
For the rest, you define `vc-default-list-files` instead.

> And then project-files would call (vc-call-backend backend 'list-files)
> and if that signals vc-not-supported call cl-call-next-method?

No.  If there's no vc-<backend>-list-files, then it calls
vc-default-list-files.  No signal.

> But how do I know the right backend without explicit tests?
> vc-backend wants a file and all I have is the project's directory.

IIRC, vc.el calls vc-backend with the directory name in those cases.

> Also, I think most vc backends have a way to list tracked files but not
> all those are faster than find is.

If it's not faster, then don't bother implementing
vc-<backend>-list-files (unless the purpose is to get a different list
rather than to get the list faster).

> So name the vc function vc-<backend>-list-files-fast and only provide
> an implementation for Git?

Sure.  But please go through the vc-call-backend mechanism so as not to
break the abstraction.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]