From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Re: Drag images from Firefox to org-mode Date: Thu, 17 Oct 2013 16:48:40 +0200 Message-ID: <87r4bkq7g7.fsf@yahoo.fr> References: <871u3krrt3.fsf@yahoo.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWos6-00035A-AX for emacs-orgmode@gnu.org; Thu, 17 Oct 2013 10:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWos0-00020L-UT for emacs-orgmode@gnu.org; Thu, 17 Oct 2013 10:48:18 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:48854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWos0-00020H-Nq for emacs-orgmode@gnu.org; Thu, 17 Oct 2013 10:48:12 -0400 In-Reply-To: (Rick Frankel's message of "Thu, 17 Oct 2013 10:04:34 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rick Frankel Cc: org mode , Carsten Dominik , Oleh Rick Frankel writes: > On 2013-10-17 08:43, Nicolas Richard wrote: >> Carsten Dominik 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.