emacs-devel
[Top][All Lists]
Advanced

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

Re: Optional argument for `file-local-copy'


From: Stefan Monnier
Subject: Re: Optional argument for `file-local-copy'
Date: Thu, 11 Dec 2014 10:22:11 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> The first idea to this came when I saw
> <http://thread.gmane.org/gmane.emacs.orgmode/92856>. It offered a patch
> to keep some copied remote images in a cache in order to redisplay
> them.

> Another evidence for such functionality is vc. If you open a remote file
> under bzr control, there will be local copies of .bzr/checkout/dirstate,
> .bzr/branch/format and .bzr/branch/last-revision. In the cvs case,
> CVS/Entries is taken via file-local-copy. And there might be similar
> cases for the other vc backends, I haven't checked. All of them are
> candidates for a file cache as proposed.

Yes, but how will you write the code so that the temp/cached files
don't linger indefinitely?

Don't get me wrong: I like the idea, but I think we need to think a bit
more about how to handle the cache and deletion, in order to design the
API correctly.

Here's the problem I currently see:
- OT1H you currently have the caller as the one responsible for the
  deletion of the file.
- OTOH it's the handler that decides where to put the file.
That seems to make it difficult to get a good behavior.  E.g. you might
want to keep the file for a long time (across sessions) in a special
"cache" subdirectory somewhere, but this decision can't be made by the
handler (because the caller will have to delete the file without knowing
it's meant to be kept) and it can't be made by the caller either
(because it can't tell the handler where to put the file).

Maybe a better option is to change the optional argument so that it's
not just a boolean but it's actually the name of a "candidate local
copy" (i.e. it's the name of the local copy kept in the cache managed
by the caller), tho maybe we'd need more info (e.g. the full
file-attributes).


        Stefan



reply via email to

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