From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Call lisp function asynchronous Date: Fri, 08 Jun 2007 13:27:13 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87myzbktwu.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1181274041 6053 80.91.229.12 (8 Jun 2007 03:40:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2007 03:40:41 +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 Jun 08 05:40:38 2007 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.50) id 1HwVL0-00034n-MI for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jun 2007 05:40:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HwVL0-0008EB-2V for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Jun 2007 23:40:34 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news.astraweb.com!border2.newsrouter.astraweb.com!sn-xt-sjc-05!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:uqJXTgAl8sBr32v2NxY79WiRHwU= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 40 Original-Xref: shelby.stanford.edu gnu.emacs.help:149185 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:44769 Archived-At: Katsumi Yamaoka writes: >>>>>> In >>>>>> Juraj Kubelka wrote: > >> Is it possible to call lisp function asynchronous? > > It is possible but rather difficult to do it in earnest. Good > examples are in emacs-w3m (http://emacs-w3m.namazu.org/). > I believe you can only do asynchronous stuff with calls to external processes. You cannot do it with other general functions. I think Emacs would need some sort of thread support to do this. >> I would like to use it with this intention: I have defined overlay on >> a region. And after few seconds I would like to delete this overlay. > >> #'(lambda (overlay) >> (sleep-for 2) >> (delete-overlay overlay)) > >> But I do not know how to call it without waiting for response (funcall >> delete-overlay overlay). >> Can you help me? Or is there better solution for it? > > A timer seems to answer such a purpose. For example: > > #'(lambda (overlay) > (run-at-time 2 nil #'delete-overlay overlay)) The timer will probably achieve what you want, but its not done asynchrously in the true sense. If the operation associated with the timer is resource intensive or long running, you are very likely to observe 'freezes'. Tim -- tcross (at) rapttech dot com dot au