From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Narendra Joshi Newsgroups: gmane.emacs.devel Subject: Re: [Feature Request] Hope Emacs can provide an async version of `url-copy-file' Date: Thu, 09 Jul 2020 22:19:52 +0200 Message-ID: <87h7ugzbiv.fsf@gmail.com> References: <87sge0zuia.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10310"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Emacs Devel To: stardiviner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 09 22:20:35 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jtd22-0002Yd-2h for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Jul 2020 22:20:34 +0200 Original-Received: from localhost ([::1]:34616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtd21-0001P2-5T for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Jul 2020 16:20:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtd1R-0000zf-UM for emacs-devel@gnu.org; Thu, 09 Jul 2020 16:19:57 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:34263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtd1Q-000505-9G for emacs-devel@gnu.org; Thu, 09 Jul 2020 16:19:57 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id y10so3671963eje.1 for ; Thu, 09 Jul 2020 13:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Vt0qEIehEXDdcvvpMTZl/mJr9mUgFMxZFuMXVJCHrgA=; b=BMxwnTSD6yZ+9rgsn13yhS1DcTdPDB95RzgxljLY/XtKWZzfADrSafao0wGG48AodK KREcflVlEh/V1CNGuWrX6tCzL9eEcbwxhiXg6yK1dzvfofYa9+VjDs1ElfmFQtEmQsXI okiTWupQMEvr/i0zFQoF+b8rerL/zDrYSsh1hKpn3E5VNLqheQ9lqcdD/u0HI/w7myk0 K8Dc6cpU9vb1zpj4g78C/gG2UB53MvV2bzNK4/jIqXnvYPRGdQgmAJPW2W3dmnSvzM15 5GuT0GzKOF5bLeNHLqt2NtIcGhfTRiZsF8KynziXKc6YwuNCnytmOnNOniupmpO8HV09 kEEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Vt0qEIehEXDdcvvpMTZl/mJr9mUgFMxZFuMXVJCHrgA=; b=YZMEsbRccFcqSFkmyfDWfjLT5E61ws3t47CVzre+HxNZn3QzjHPAs1O49f5JX7m1ZN /NtUqW475fsVQS4eoJy1u/cRHXDjub5LkELzcJHuhYfeda7TxmUkMGQvSlyHU7jpgpC+ 7N6sjObPYEnguKvKCzpRWGbiZp0L9tjj3inQI3BDpbMtn8ws1bSJu/DUAxd+UvqZy0k9 MJ0XvKLn3R22I9AsJEjz7Scm90cKf4rCQonv1qHH0U30kf7Cp4/z5GZr9UHS+krTKztj LO4YFVefrZeCp8KfBPek3hqid0tb23VX7jMYNWSTtSeh1lproYBPEDKGyFQP1ilieyEF hF5Q== X-Gm-Message-State: AOAM532sWR6kD8uWORXqylc+vczLyVdk6Bra/ecW4fZS4GBr+eTHBvvE SToxqf87TJKxqr8bIsQ28vJoAo2Xvw== X-Google-Smtp-Source: ABdhPJxKNkDSwzv4yHi9A1sflFRLebcwZUDYTxI+M99TJ51SLdef6VYe+FJmIuxEBaMr3B6cUg4f6g== X-Received: by 2002:a17:906:404e:: with SMTP id y14mr56915295ejj.260.1594325993984; Thu, 09 Jul 2020 13:19:53 -0700 (PDT) Original-Received: from vicarie ([2a02:8109:b640:2344::529c]) by smtp.gmail.com with ESMTPSA id q3sm2645068eds.41.2020.07.09.13.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 13:19:53 -0700 (PDT) In-Reply-To: <87sge0zuia.fsf@gmail.com> (stardiviner's message of "Thu, 09 Jul 2020 21:29:49 +0800") Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=narendraj9@gmail.com; helo=mail-ej1-x634.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252801 Archived-At: stardiviner 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