emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [Patch] org-display-inline-images: Add support for remote images


From: Kit-Yan Choi
Subject: Re: [O] [Patch] org-display-inline-images: Add support for remote images
Date: Wed, 26 Nov 2014 12:13:15 -0500

Thank you!  These are interesting ideas!  For both of these suggestions, I think I will need a look-up table using the remote file paths as keys, the local copy paths as values.  

But is it theoretically possible to have two remote file paths sharing the same local copy file name?  i.e. `make-temp-file' generates the same temporary file name for two separate calls?
If such a situation occurs, then: (1) the local copy of one remote image will be overwritten by another (2) it is wrong to try to update the local copy based on the time stamp of a wrong remote file.

As far as org-mode is concerned, and assuming the current stable version of tramp, I think there are two options (1) the current approach which preserves the path of the remote file and therefore avoid unnecessary downloads; however we forgo the capability of compression that tramp's file-local-copy offers, (2) use `file-local-copy' but risk overwriting (albeit unlikely) downloaded local copy; this is possible with or with out a look-up table for reusing files.

And yes, for those who prefer seeing an empty box instead of downloading remote images for display, I will add an option for turning this functionality ON/OFF, default off maybe.

Thanks,
Kit


On Tue, Nov 25, 2014 at 12:04 PM, Michael Albinus <address@hidden> wrote:
Kit-Yan Choi <address@hidden> writes:

> Michael,

Hi Kit,

> Thanks for the suggestion. Indeed `file-local-copy' would have made
> the code cleaner. Yet `file-local-copy' generates a new filename each
> time it's run. But I wanted to allow the code to check whether the
> remote image has already been fetched before and so skip unnecessary
> file transfer, which takes time (think of it like "rsync -a").
> Therefore I wanted to preserve the remote path under a temporary
> directory.

After first retrieval via file-local-copy, you could cache this
information somewhere for later use.

Or you could write a ticket towards Tramp, that file-local-copy shall
remember that a file was downloaded already, and should offer that file
for reuse.

Note: I'm the Tramp maintainer :-)

> Best,
> Kit

Best regards, Michael.


reply via email to

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