emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kit-Yan Choi <kit@kychoi.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Patch] org-display-inline-images: Add support for remote images
Date: Wed, 26 Nov 2014 12:13:15 -0500	[thread overview]
Message-ID: <CAKHbGXWic1MsRjC=7pEsjSgBuYgYEBKg-2Mn8bTAcmEMw4JAzA@mail.gmail.com> (raw)
In-Reply-To: <8761e31aa6.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

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 <michael.albinus@gmx.de>
wrote:

> Kit-Yan Choi <kit@kychoi.org> 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.
>

[-- Attachment #2: Type: text/html, Size: 2830 bytes --]

  reply	other threads:[~2014-11-26 17:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-22  4:43 [Patch] org-display-inline-images: Add support for remote images Kit-Yan Choi
2014-11-25  8:32 ` Nicolas Goaziou
2014-11-25 15:15   ` Kit-Yan Choi
2014-11-25 15:23     ` Rasmus
2014-11-25 15:29     ` Kit-Yan Choi
2014-11-25 15:39       ` Michael Albinus
2014-11-25 15:45         ` Kit-Yan Choi
2014-11-25 17:04           ` Michael Albinus
2014-11-26 17:13             ` Kit-Yan Choi [this message]
2014-11-29 10:50               ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKHbGXWic1MsRjC=7pEsjSgBuYgYEBKg-2Mn8bTAcmEMw4JAzA@mail.gmail.com' \
    --to=kit@kychoi.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).