Rick Frankel <r...@rickster.com> writes: > On 2013-10-17 08:43, Nicolas Richard wrote: >> Carsten Dominik <drostekirs...@gmail.com> writes: >> does anyone know how general this code is? Does it works on >> different operating systems? >> We might want to include this into the Org core. >> >> Since it is based on dnd, and since the documentation of dnd reads: >> ;; This file provides the generic handling of the drop part only. >> ;; Different DND backends (X11, W32, etc.) that handle the platform >> ;; specific DND parts call the functions here to do final delivery of >> ;; a drop. >> I'd highly suspect that the code is portable. > > It does make use of `wget', which may not be avalalable on all systems > (e.g., i believe os x only includes `curl' by default.) So it would > need to allow configuration of the image fetch command.
I'm sorry I missed that. Indeed, on the one "OS X" I ever tried to run wget on, it didn't have wget. Perhaps url-retrieve can be used instead. I have no time right now to code it right, but here's a (synchronous) example with url + filetype + filename all hardcoded : (with-current-buffer (url-retrieve-synchronously "http://www.cnrtl.fr/images/css/bandeau.jpg") (delete-region (point-min) (progn (re-search-forward "^$" nil 'move) (point))) (write-file (expand-file-name "~/tmp/foobar.jpg")) (pop-to-buffer (current-buffer))) using url-retrieve (which is asynchroneous) might also lift the requirement on async.el -- Nico.