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: Michael Albinus
Subject: Re: [O] [Patch] org-display-inline-images: Add support for remote images
Date: Tue, 25 Nov 2014 16:39:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Kit-Yan Choi <address@hidden> writes:

> Ah my apologies. I forgot I had to use `file-name-directory' for
> creating the path to the temporary directory (too long ago since I did
> this). Here is the corrected version.
>
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -19340,7 +19340,7 @@ boundaries."
> (not (cdr (org-element-contents parent)))))
> (org-string-match-p file-extension-re
> (org-element-property :path link)))
> - (let ((file (expand-file-name (org-element-property :path link))))
> + (let ((file (substitute-in-file-name (expand-file-name
> (org-element-property :path link)))))
> (when (file-exists-p file)
> (let ((width
> ;; Apply `org-image-actual-width' specifications.
> @@ -19378,10 +19378,25 @@ boundaries."
> 'org-image-overlay)))
> (if (and (car-safe old) refresh)
> (image-refresh (overlay-get (cdr old) 'display))
> - (let ((image (create-image file
> - (and width 'imagemagick)
> - nil
> - :width width)))
> + (let ((image 
> + (create-image (if (org-file-remote-p file)
> + (let* ((tramp-tmpdir (concat
> + (if (featurep 'xemacs)
> + (temp-directory)
> + temporary-file-directory)
> + "/tramp"
> + (file-name-directory (expand-file-name file))))
> + (newname (concat
> + tramp-tmpdir 
> + (file-name-nondirectory (expand-file-name file)))))
> + (make-directory tramp-tmpdir t)
> + (if (file-newer-than-file-p file newname)
> + (copy-file file newname t t))
> + newname)
> + file)
> + (and width 'imagemagick)
> + nil
> + :width width)))
> (when image
> (let* ((link
> ;; If inline image is the description

This code looks much to complicate to me. Wouldn't a simple
file-local-copy suffice? You don't need to care whether the file is
remote (let Tramp do the job) or local (there won't be a copy).

Best regards, Michael.



reply via email to

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