[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SOLVED] Re: [Feature Request] Hope Emacs can provide an async version o
From: |
stardiviner |
Subject: |
[SOLVED] Re: [Feature Request] Hope Emacs can provide an async version of `url-copy-file' |
Date: |
Wed, 15 Jul 2020 13:40:14 +0800 |
User-agent: |
mu4e 1.5.5; emacs 28.0.50 |
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