From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: Re: Drag images from Firefox to org-mode Date: Fri, 18 Oct 2013 14:24:45 -0400 Message-ID: <857b1a922e24dda4404df4d19fabd7e2@mail.rickster.com> References: <87eh7irjvi.fsf@yahoo.fr> <52610C29.3000505@yahoo.fr> <526114B4.6060303@yahoo.fr> <2d5635af9ad6d51badb40e1e19c85572@mail.rickster.com> <87y55qpp44.fsf@yahoo.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_50a528dd4f95e4653acf75f3e7172bfc" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXEjD-000794-Eh for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 14:24:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXEj7-0003tb-Me for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 14:24:51 -0400 Received: from [204.62.15.78] (port=47642 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXEj7-0003sv-Gv for emacs-orgmode@gnu.org; Fri, 18 Oct 2013 14:24:45 -0400 In-Reply-To: <87y55qpp44.fsf@yahoo.fr> 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: Nicolas Richard Cc: org mode , Oleh --=_50a528dd4f95e4653acf75f3e7172bfc Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8; format=flowed On 2013-10-18 11:36, Nicolas Richard wrote: > Note that using > (let ((coding-system-for-write 'no-conversion)) > (write-region nil nil filename nil nil nil 'confirm)) > instead of > (write-file ...) > seemed to fix the problem for Oleh. Attached is a patch against Nico's url-retrieve-alt which cleans-up some issues w/ the defcustoms and make the interactive version of `org-download-image' prompt for a url instead of attempting to use the clipboard (which kept throwing errors for me). At least in my environment (Chrome -> cygwin emacs on Windows NT),DND doesn't work on windows. It also uses url-parse to get the image file name, as images with cache-busters were failing to download (e.g. http://example.com/image.jpg?20120101). Again, sorry I can't do a branch and pull request, don't have push access to github from here. rick --=_50a528dd4f95e4653acf75f3e7172bfc Content-Transfer-Encoding: base64 Content-Type: text/x-lisp; name=0001-org-download.el.patch Content-Disposition: attachment; filename=0001-org-download.el.patch; size=4670 RnJvbSA4MThiNmE2NjEwODdiZmFiYjczNjNlMDYyNDliYjkyNTc0MGY5NjE2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBSaWNrIEZyYW5rZWwgPHJpY2tAcmlja3N0ZXIuY29tPgpEYXRl OiBGcmksIDE4IE9jdCAyMDEzIDE0OjAzOjAzIC0wNDAwClN1YmplY3Q6IFtQQVRDSF0gKiBvcmct ZG93bmxvYWQuZWwgKCk6ICAgLSBvcmctZG93bmxvYWQtaW1hZ2UtZGlyOiBGaXgKIG1pc21hdGNo IGVycm9yIChzdHJpbmcgc2V0IHRvIG5pbC4pICAgLQogb3JnLWRvd25sb2FkLS1iYWNrZW5kLWNt ZDogUmVtb3ZlZC4gICAtCiBvcmctZG93bmxvYWQtYmFja2VuZDogVXNlIGEgY2hvaWNlIGluc3Rl YWQgb2YgYSBzdHJpbmcKIHJlcHJlbnNlbnRpbmcgICB0aGUgdGFnLiAob3JnLWRvd25sb2FkLS1m dWxsbmFtZSk6IFVzZQogdXJsLXBhcnNlIHRvIHJlbW92ZSBxdWVyeSBwYXJhbXMgdXJscy4gVXNl ICAKIGBmaWxlLW5hbWUtbm9uZGlyZWN0b3J5JyBpbnN0ZWFkIG9mIHNwbGl0dGluZyBvbiBzbGFz aGVzLgogKG9yZy1kb3dubG9hZC0taW1hZ2UpOiBVc2UgYG9yZy1kb3dubG9hZC1iYWNrZW5kJyBk aXJlY3RseQogYW5kIGdlbmV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yBpbmxpbmUgaW1hZ2VzIGluIGN1cnJlbnQgYnVmZmVyLiIKLSAg KGlmIChlcSBvcmctZG93bmxvYWQtYmFja2VuZCAndXJsLXJldHJpZXZlKQorICAoaWYgKGVxIG9y Zy1kb3dubG9hZC1iYWNrZW5kIHQpCiAgICAgICAodXJsLXJldHJpZXZlCiAgICAgICAgbGluawog ICAgICAgIChsYW1iZGEgKHN0YXR1cyBmaWxlbmFtZSBidWZmZXIpCi0gICAgICAgICAiV3JpdGUg Y3VycmVudCBidWZmZXIgdG8gRklMRU5BTUUgYW5kIHVwZGF0ZSBpbmxpbmUgaW1hZ2VzIGluIEJV RkZFUiIKKyAgICAgICAgIDs7IFdyaXRlIGN1cnJlbnQgYnVmZmVyIHRvIEZJTEVOQU1FIAorICAg ICAgICAgOzsgYW5kIHVwZGF0ZSBpbmxpbmUgaW1hZ2VzIGluIEJVRkZFUgogICAgICAgICAgKGxl dCAoKGVyciAocGxpc3QtZ2V0IHN0YXR1cyA6ZXJyb3IpKSkKLSAgICAgICAgICAgKGlmIGVycgot ICAgICAgICAgICAgICAgKHNpZ25hbCA6ZXJyb3IgKGNkciBlcnIpKSkpCisgICAgICAgICAgIChp ZiBlcnIgKGVycm9yCisgICAgICAgICAgICAgICAgICAgICJcIiVzXCIgJXMuIiB1cmwKKyAgICAg ICAgICAgICAgICAgICAgKGRvd25jYXNlIChudGggMiAoYXNzcSAobnRoIDIgZXJyKSB1cmwtaHR0 cC1jb2RlcykpKSkpKQogICAgICAgICAgKGRlbGV0ZS1yZWdpb24KICAgICAgICAgICAocG9pbnQt bWluKQogICAgICAgICAgIChwcm9nbgpAQCAtMTI1LDE2ICsxMjUsMTUgQEAgY3VzdG9tIHZhcmlh Ymxlcy4iCiAgICAgKHJlcXVpcmUgJ2FzeW5jKQogICAgIChhc3luYy1zdGFydAogICAgICBgKGxh bWJkYSgpIChzaGVsbC1jb21tYW5kCi0gICAgICAgICAgICAgICAgICwoZm9ybWF0IG9yZy1kb3du bG9hZ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