From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Richard Subject: Re: Drag images from Firefox to org-mode Date: Fri, 18 Oct 2013 17:39:50 +0200 Message-ID: <87vc0upozd.fsf@yahoo.fr> References: <871u3krrt3.fsf@yahoo.fr> <87r4bkq7g7.fsf@yahoo.fr> <8bb344a96ebde88ceca14f1b523bd5a8@mail.rickster.com> <87k3hbqh88.fsf@yahoo.fr> <9265ea6f8a8b76ddf5d77de837d057a8@mail.rickster.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXC9A-0007Th-6V for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 11:39:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXC94-0002tC-1N for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 11:39:28 -0400 Received: from mxin.ulb.ac.be ([164.15.128.112]:55204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXC93-0002t7-S3 for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 11:39:21 -0400 In-Reply-To: <9265ea6f8a8b76ddf5d77de837d057a8@mail.rickster.com> (Rick Frankel's message of "Fri, 18 Oct 2013 10:44:37 -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: emacs-orgmode@gnu.org Rick Frankel writes: > On 2013-10-18 01:29, Nicolas Richard wrote: >> Rick Frankel writes: >> One small problem, should be =(1+ (point))=, as the above leaves a >> blank newline at the head of the jpg, making it invalid. >> >> Oops, yes [Initially I had (search-forward "\n\n"), which worked >> fine,... then changed my mind and didn't test. Silly me.] >> >> Your code downloaded two images easily, but >> (signal :error (cdr err)))) >> signals a weird error for me (something like: "error in >> process filter: if: peculiar error: http, 404"). I suggest: >> >> (error "Error fetching URL %s: %s" url (cdr err)) > > That seems fine. I was just following the suggestion in the doc string > for `url-retrieve'. Indeed, it is bizarre because err contains e.g. (error http 404), which is claimed to be of the form ERROR-SYMBOL . DATA, but (car DATA) must be a string according to (info "(elisp) Signaling Errors") : ,---- | For `error', the error message is | the CAR of DATA (that must be a string). `---- > BTW, did you know that org already has a function which works > perfectly for this purpose (well, it's synchronous, but otherwise...) > `org-feed-get-feed'? No, I didn't know that (but I think doing things asynchronously has added value). > (let ((err (plist-get status :error))) > (if err (error > "\"%s\" %s." url > (downcase (nth 2 (assq (nth 2 err) url-http-codes)))))) Nice -- Nico.