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

2014-01-04 Thread Bastien
Hi Oleh, Oleh writes: > Here's a patch to add org-download to org-mode. Great, thanks. Please add this to contrib/lisp/ -- we try to keep Org's core minimalistic because core is merged to Emacs. Best, -- Bastien

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

2014-01-04 Thread Oleh
Hi all, Here's a patch to add org-download to org-mode. I've had the additional features (the screenshots and local files) implemented some time ago, but never got around to wrapping it up. Feedback welcome. regards Oleh > There's still two functionality bits that I want to add: > local files an

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

2013-10-23 Thread Christian Moe
Torsten Wagner writes: > Thunderlink (a thunderbird plugin), instead is able to fetch the > message-id, which is unique and independent on the mail position. If > there is an interest to extend the drag and drop to emails, I could > ask the developer of thunderlink if there is a way to change the

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

2013-10-23 Thread Torsten Wagner
Hi, I have to correct myself, I could use the link created by thunderbird drag and drop. I simply missed to put the link into quotes. This works, thunderbird will open the message in a new view. thunderbird -mails "imap://user.name%2borganisation@mailsystem.organisation.com:993/fetch>UID>/INB

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

2013-10-23 Thread Torsten Wagner
Hi, just wonder if we can drag-and-drop images into org-mode could we drag-and drop emails from e.g. thunderbird too. There is a plugin for thunderbird call thunderlink which allows to generate org-mode readable links. However, drag and drop an email in a browser gives a address which looks like:

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

2013-10-23 Thread Oleh
On Wed, Oct 23, 2013 at 7:13 PM, Rick Frankel wrote: > On 2013-10-20 16:42, Nicolas Richard wrote: >> >> Oleh writes: >> This can be fixed with a platform-aware function that checks both the >> clipboard and the cut-buffer. >> >> I suggest to ask for a string with (read-string "URL: " nil nil def

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

2013-10-23 Thread Rick Frankel
On 2013-10-20 16:42, Nicolas Richard wrote: Oleh writes: This can be fixed with a platform-aware function that checks both the clipboard and the cut-buffer. I suggest to ask for a string with (read-string "URL: " nil nil default), offering the content of the clipboard/kill ring/selections as t

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

2013-10-21 Thread Oleh
> I suggest to ask for a string with (read-string "URL: " nil nil default), > offering the content of the clipboard/kill ring/selections as the DEFAULT. > I think it's better to be explicit when downloading content, and there > isn't much overhead in asking for a confirmation. I've moved the clipb

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

2013-10-20 Thread Nicolas Richard
Oleh writes: > This can be fixed with a platform-aware function that checks both the > clipboard and the cut-buffer. I suggest to ask for a string with (read-string "URL: " nil nil default), offering the content of the clipboard/kill ring/selections as the DEFAULT. I think it's better to be expli

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

2013-10-19 Thread Oleh
Thanks for the feedback, Rick. I strongly disagree, for a couple of reasons: > > - Esp. on non-unix systems, the contents of the cut-buffer are not > necessarily the same as the contents of the system clipboard. This > is the problem I was having w/ your code on windows, where the > cut-buff

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

2013-10-18 Thread Rick Frankel
On Fri, Oct 18, 2013 at 09:22:17PM +0200, Oleh wrote: >Thanks, Rick and Nico, I've merged the code. >All except the last bit from Rick: I can't think of any sensible >way to enter an image URL except pasting it. >And since link will be in the clipboard at some point, why not use >

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

2013-10-18 Thread Oleh
Thanks, Rick and Nico, I've merged the code. All except the last bit from Rick: I can't think of any sensible way to enter an image URL except pasting it. And since link will be in the clipboard at some point, why not use it straight away without prompting. Maybe URL can be prompted for when call

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

2013-10-18 Thread Rick Frankel
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 s

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

2013-10-18 Thread Rick Frankel
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. got it. BTW, you might want to add the error message cleanup (i can't

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

2013-10-18 Thread Nicolas Richard
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 >>

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

2013-10-18 Thread Nicolas Richard
Rick Frankel writes: >> Le 18/10/2013 12:44, Oleh a écrit : >> I attach the downloaded google logo. > > I missed an email here... can you send me the url to the image you are > having problems with? I received it by email, here it is : http://cjoint.com/13oc/CJsrG1j2Szg.htm Note that using

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

2013-10-18 Thread Rick Frankel
On 2013-10-18 07:00, Nicolas Richard wrote: [re-adding emacs-orgmode@gnu.org to cc, I don't know when it got lost] Le 18/10/2013 12:44, Oleh a écrit : I attach the downloaded google logo. I missed an email here... can you send me the url to the image you are having problems with? I just tried

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

2013-10-18 Thread Rick Frankel
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

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

2013-10-18 Thread Oleh
> > > Did you try the url-retrieve or the url-retrieve-alt branch ? > The url-retrieve-alt branch. Oleh

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

2013-10-18 Thread Nicolas Richard
[re-adding emacs-orgmode@gnu.org to cc, I don't know when it got lost] Le 18/10/2013 12:44, Oleh a écrit : > I attach the downloaded google logo. Thanks. diffing them, it looks pretty much like an encoding problem. > I just tried your code and it works fine for the same image. Did you try the u

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

2013-10-18 Thread Nicolas Richard
Oleh writes: > I've just tested Rick Frankel's code, and I got > a broken jpg (it's half green and distorted). It appears so > it org-mode inline and in eog, but it displays properly in its own > Emacs buffer. > Looks like it needs more work. Perhaps you could test this version instead: ://githu

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

2013-10-18 Thread Nicolas Richard
Le 18/10/2013 12:04, Oleh a écrit : > I've just tested Rick Frankel's code, and I got > a broken jpg (it's half green and distorted). It appears so > it org-mode inline and in eog, but it displays properly in its own Emacs > buffer. > Looks like it needs more work. Could you please put the link

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

2013-10-18 Thread Oleh
Hi Nicolas, I've just tested Rick Frankel's code, and I got a broken jpg (it's half green and distorted). It appears so it org-mode inline and in eog, but it displays properly in its own Emacs buffer. Looks like it needs more work. regards, Oleh On Fri, Oct 18, 2013 at 11:47 AM, Nicolas Richar

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

2013-10-18 Thread Nicolas Richard
Oleh writes: > I tried before url-retrieve, but it was giving me some garbage in > addition to the image. > But if I figure it out, I could add url-retrieve as the third custom > method. If the garbage is the HTTP headers, then that problem is solved in Rick Frankel's code. If there's any other

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

2013-10-18 Thread Oleh
Hi Carsten, You can commit it whenever you like. I don't currently have access to Windows or OSX, so it's hard to see if the code works everywhere. regards, Oleh On Fri, Oct 18, 2013 at 11:28 AM, Carsten Dominik wrote: > Hi Oleh, > > this is very nice thank you. > > If you want, turn this into

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

2013-10-18 Thread Carsten Dominik
Hi Oleh, this is very nice thank you. If you want, turn this into a patch to org.el. If not, I will do so later. - Carsten On Oct 18, 2013, at 11:24 AM, Oleh wrote: > Hi Carsten, > > The dependencies are async, dnd and wget. > > In case dnd doesn't work, there's a fallback to clipboard via

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

2013-10-18 Thread Oleh
Hi Carsten, The dependencies are async, dnd and wget. In case dnd doesn't work, there's a fallback to clipboard via `current-kill'. I've just added a custom variable that takes either 'wget or 'curl as the download method. I tried before url-retrieve, but it was giving me some garbage in additi

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

2013-10-17 Thread Nicolas Richard
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

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

2013-10-17 Thread Rick Frankel
On 2013-10-17 10:48, Nicolas Richard wrote: 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 d

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

2013-10-17 Thread Nicolas Richard
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 documenta

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

2013-10-17 Thread Rick Frankel
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 provi

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

2013-10-17 Thread Nicolas Richard
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

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

2013-10-17 Thread Carsten Dominik
Hi Oleh and others, 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. - Carsten On Oct 16, 2013, at 12:04 PM, Oleh wrote: > Hi all, > > Here's a little hack that I use to make my life easier: > > (requi

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

2013-10-17 Thread Samuel Loury
Marcin Borkowski writes: > Dnia 2013-10-16, o godz. 17:52:51 > Oleh napisał(a): > >> The address and date are auto-added as a comment now. >> The updated source can be found at >> https://github.com/abo-abo/org-download >> >> Images can be stored in a custom dir with: >> >> (setq org-download

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

2013-10-16 Thread Eric Abrahamsen
Oleh writes: > The address and date are auto-added as a comment now. > The updated source can be found at https://github.com/abo-abo/org-download > > Images can be stored in a custom dir with: > > (setq org-download-image-dir "~/Pictures/org") > > I still want to add some rescaling option via Ima

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

2013-10-16 Thread Marcin Borkowski
Dnia 2013-10-16, o godz. 17:52:51 Oleh napisał(a): > The address and date are auto-added as a comment now. > The updated source can be found at > https://github.com/abo-abo/org-download > > Images can be stored in a custom dir with: > > (setq org-download-image-dir "~/Pictures/org") > > I stil

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

2013-10-16 Thread Oleh
The address and date are auto-added as a comment now. The updated source can be found at https://github.com/abo-abo/org-download Images can be stored in a custom dir with: (setq org-download-image-dir "~/Pictures/org") I still want to add some rescaling option via ImageMagick and an option for l

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

2013-10-16 Thread Xebar Saram
Thx Oleh ,This is really amazing! Ive been waiting for ages for something like this. a few questions (well ok"requests" :)..) if you dont mind. please bare in mind i have zero coding skills (or understanding so my questions may be stupid :)) 1.i use alot of images and :in alot of headings and sub

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

2013-10-16 Thread Torsten Wagner
This looks like a nice feature! Maybe you could add to save the address and date the picture was taken, thus, one could easily refer to the image origin. That is sometimes of importance. Thanks for sharing Torsten On 16 October 2013 12:04, Oleh wrote: > Hi all, > > Here's a little hack that

[O] Drag images from Firefox to org-mode

2013-10-16 Thread Oleh
Hi all, Here's a little hack that I use to make my life easier: (require 'async) (eval-when-compile (require 'cl)) (defun org-store-image (link basedir) (async-start `(lambda() (shell-command ,(format "wget \"%s\" -P \"%s\"" link (expand-file