[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 11 Aug 2017 12:26:51 +0200
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
Jonas Bernoulli <address@hidden> writes:
> Hi Michael,
Hi Jonas, Dmitry,
>> The idea of writing a file name handler for versioned files is on my
>> todo list for years.
> Same here ;-) But I very much hope I get to it toward the end of August.
>> But I have 15 years experience in using file name handlers in Emacs. If
>> you need any help to write such a library, I would be glad to support
>> you. Just ping me, if you believe it could be useful.
> Thanks for the offer. I will contact you when I actually start working
> on this. If you get to it before I do, then please let me have a look,
> to make sure it satisfies Magit's needs.
As a warmup, I have written vc-handler.el and vc-git-handler.el. They
are far from being complete, but they'll show what's possible.
A revisioned filename is something like "/path/to/file@@revision".
"revision" could be a revision like "81656add81", a branch like
"scratch/kqueue", or a tag like "emacs-19.34". Of course, the syntax
could be changed.
vc-handler.el is the common part. There is the alist
`vc-file-name-handler-alist', which lists for every magic file name
function the responsible handler function. The majority of them is also
implemented in vc-handler.el, because they don't need any vcs specific
For every different backend, there could be a respective backend
package. I've implemented vc-git-handler.el, because I know more about
vc-git than magit. But there's no problem to implement vc-magit.el, for
example. I plan also to write at least vc-cvs.el.
You might play a little bit to see how it looks like. Maybe the most
simple start is to enter dired, because it uses many of the magic file
name operations. Just do "C-x d ~/src/emacs/src/emacs.c@@" (supposed
your Emacs git is located at ~/src/emacs, as in my case).
Both packages are far from being complete. Performance is terrible (a
proper cache mechanism is needed), my git skill is restricted so I might
not use the best commands, and you will see many TODO comments. It's
just a proof of concept. And I hope it is useful for both magit and vc.
Best regards, Michael.