help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call lisp function asynchronous


From: Tim X
Subject: Re: Call lisp function asynchronous
Date: Fri, 08 Jun 2007 13:27:13 +1000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> In <mailman.1698.1181180879.32220.help-gnu-emacs@gnu.org>
>>>>>>  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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]