* Call lisp function asynchronous
@ 2007-06-07 1:47 Juraj Kubelka
0 siblings, 0 replies; 5+ messages in thread
From: Juraj Kubelka @ 2007-06-07 1:47 UTC (permalink / raw)
To: help-gnu-emacs
Hi!
Is it possible to call lisp function asynchronous?
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?
Thank you in advance.
Juraj
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.1698.1181180879.32220.help-gnu-emacs@gnu.org>]
* Re: Call lisp function asynchronous
[not found] <mailman.1698.1181180879.32220.help-gnu-emacs@gnu.org>
@ 2007-06-07 2:02 ` Katsumi Yamaoka
2007-06-07 9:07 ` Juraj Kubelka
2007-06-08 3:27 ` Tim X
0 siblings, 2 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2007-06-07 2:02 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> 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 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))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Call lisp function asynchronous
2007-06-07 2:02 ` Katsumi Yamaoka
@ 2007-06-07 9:07 ` Juraj Kubelka
2007-06-08 3:27 ` Tim X
1 sibling, 0 replies; 5+ messages in thread
From: Juraj Kubelka @ 2007-06-07 9:07 UTC (permalink / raw)
To: Katsumi Yamaoka; +Cc: help-gnu-emacs
On 7.6.2007, at 4:02, Katsumi Yamaoka wrote:
>>>>>> 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 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))
Yes, it is the solution. Thank you a lot.
Juraj
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Call lisp function asynchronous
2007-06-07 2:02 ` Katsumi Yamaoka
2007-06-07 9:07 ` Juraj Kubelka
@ 2007-06-08 3:27 ` Tim X
2007-06-09 4:14 ` Barry Margolin
1 sibling, 1 reply; 5+ messages in thread
From: Tim X @ 2007-06-08 3:27 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Call lisp function asynchronous
2007-06-08 3:27 ` Tim X
@ 2007-06-09 4:14 ` Barry Margolin
0 siblings, 0 replies; 5+ messages in thread
From: Barry Margolin @ 2007-06-09 4:14 UTC (permalink / raw)
To: help-gnu-emacs
In article <87myzbktwu.fsf@lion.rapttech.com.au>,
Tim X <timx@nospam.dev.null> wrote:
> 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'.
That's still truly asynchronous. Asynchronous means that something
happens automatically when some condition occurs, rather than being part
of the sequential operation of the program.
Whether the main operation of the program continues in parallel is an
orthogonal issue.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-09 4:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 1:47 Call lisp function asynchronous Juraj Kubelka
[not found] <mailman.1698.1181180879.32220.help-gnu-emacs@gnu.org>
2007-06-07 2:02 ` Katsumi Yamaoka
2007-06-07 9:07 ` Juraj Kubelka
2007-06-08 3:27 ` Tim X
2007-06-09 4:14 ` Barry Margolin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).