From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.help Subject: Re: Asynchronously downloading a file Date: Fri, 02 Jul 2010 09:41:37 +0200 Message-ID: <87k4pe72ku.fsf@arcor.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1278056569 7350 80.91.229.12 (2 Jul 2010 07:42:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Jul 2010 07:42:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 02 09:42:47 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OUatX-0006fv-Tf for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jul 2010 09:42:44 +0200 Original-Received: from localhost ([127.0.0.1]:40670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUatX-0003Av-Ak for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jul 2010 03:42:43 -0400 Original-Received: from [140.186.70.92] (port=51227 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUasq-0003A4-PK for help-gnu-emacs@gnu.org; Fri, 02 Jul 2010 03:42:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUasp-0001yE-J6 for help-gnu-emacs@gnu.org; Fri, 02 Jul 2010 03:42:00 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51414) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUasp-0001xt-D3 for help-gnu-emacs@gnu.org; Fri, 02 Jul 2010 03:41:59 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OUasm-0006KA-W4 for help-gnu-emacs@gnu.org; Fri, 02 Jul 2010 09:41:57 +0200 Original-Received: from dslc-082-083-042-082.pools.arcor-ip.net ([82.83.42.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Jul 2010 09:41:56 +0200 Original-Received: from deng by dslc-082-083-042-082.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 02 Jul 2010 09:41:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 30 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dslc-082-083-042-082.pools.arcor-ip.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) Mail-Copies-To: never Cancel-Lock: sha1:9SFMv8jvai3qZQHtPtLZZjLGmgU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74042 Archived-At: Deniz Dogan writes: > I'm currently using find-file to view images fetched over HTTP. > However, sometimes the server hosting the image is kind of slow and > thus Emacs just hangs waiting for the image to fully download before I > can view it. > > Is there any existing Emacs functionality which asynchronously gets a > file from any of the protocols that e.g. find-file (tramp?) supports > which lets me provide a callback function? I don't think there's something in Emacs proper which does that right away. At least for http, you could use emacs-w3m, which support asynchronous retrieval of URLs: (w3m-retrieve URL &optional NO-UNCOMPRESS NO-CACHE POST-DATA REFERER HANDLER) Retrieve web contents pointed to by URL. It will put the retrieved contents into the current buffer. [...] If HANDLER is a function, this function will come to an end in no time. In this case, contents will be retrieved by the asynchronous process after a while. And after finishing retrieving contents successfully, HANDLER will be called on the buffer where this function starts. [...] Regards, David