emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Drag images from Firefox to org-mode


From: Nicolas Richard
Subject: Re: [O] Drag images from Firefox to org-mode
Date: Fri, 18 Oct 2013 17:39:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Rick Frankel <address@hidden> writes:

> On 2013-10-18 01:29, Nicolas Richard wrote:
>> Rick Frankel <address@hidden> 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.



reply via email to

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