unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [Feature Request] Hope Emacs can provide an async version of `url-copy-file'
@ 2020-07-09 13:29 stardiviner
  2020-07-09 20:19 ` Narendra Joshi
  0 siblings, 1 reply; 3+ messages in thread
From: stardiviner @ 2020-07-09 13:29 UTC (permalink / raw)
  To: Emacs Devel


Because sometimes network is not good, so downloading might suspend Emacs for a
long time. So I'm trying to implement an async downloading of `org-attach-url'
in org-mode. But it require async version of `url-copy-file', write redundant
code is not useful. Also I'm not able to implement that. So I send email for
feature request here.

Thanks in advance.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Feature Request] Hope Emacs can provide an async version of `url-copy-file'
  2020-07-09 13:29 [Feature Request] Hope Emacs can provide an async version of `url-copy-file' stardiviner
@ 2020-07-09 20:19 ` Narendra Joshi
  2020-07-15  5:40   ` [SOLVED] " stardiviner
  0 siblings, 1 reply; 3+ messages in thread
From: Narendra Joshi @ 2020-07-09 20:19 UTC (permalink / raw)
  To: stardiviner; +Cc: Emacs Devel

stardiviner <numbchild@gmail.com> writes:

> Because sometimes network is not good, so downloading might suspend Emacs for a
> long time. So I'm trying to implement an async downloading of `org-attach-url'
> in org-mode. But it require async version of `url-copy-file', write redundant
> code is not useful. Also I'm not able to implement that. So I send email for
> feature request here.
>
> Thanks in advance.

Would using threads work for your use case given that it's network
I/O. For example, this downloads a large file without blocking Emacs:

#+begin_src emacs-lisp
(make-thread (lambda () (url-copy-file "https://speed.hetzner.de/100MB.bin" "/tmp/test.txt")))
#+end_src

Best,
-- 
Narendra Joshi



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [SOLVED] Re: [Feature Request] Hope Emacs can provide an async version of `url-copy-file'
  2020-07-09 20:19 ` Narendra Joshi
@ 2020-07-15  5:40   ` stardiviner
  0 siblings, 0 replies; 3+ messages in thread
From: stardiviner @ 2020-07-15  5:40 UTC (permalink / raw)
  To: Narendra Joshi; +Cc: stardiviner, Emacs Devel


Narendra Joshi <narendraj9@gmail.com> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> Because sometimes network is not good, so downloading might suspend Emacs for a
>> long time. So I'm trying to implement an async downloading of `org-attach-url'
>> in org-mode. But it require async version of `url-copy-file', write redundant
>> code is not useful. Also I'm not able to implement that. So I send email for
>> feature request here.
>>
>> Thanks in advance.
>
> Would using threads work for your use case given that it's network
> I/O. For example, this downloads a large file without blocking Emacs:
>
> #+begin_src emacs-lisp
> (make-thread (lambda () (url-copy-file "https://speed.hetzner.de/100MB.bin" "/tmp/test.txt")))
> #+end_src
>
> Best,

Thanks Narendra, this indeed is an great simple solution.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-15  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 13:29 [Feature Request] Hope Emacs can provide an async version of `url-copy-file' stardiviner
2020-07-09 20:19 ` Narendra Joshi
2020-07-15  5:40   ` [SOLVED] " stardiviner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).