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

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

Re: waiting for asynchronous processes


From: Perry Smith
Subject: Re: waiting for asynchronous processes
Date: Sun, 16 Oct 2011 07:49:28 -0500

On Oct 16, 2011, at 4:16 AM, Štěpán Němec wrote:

> On Sun, 16 Oct 2011 03:49:51 +0200
> Perry Smith wrote:
> 
>> I was hooking this into a keyboard macro so I basically wanted to "do 
>> nothing"
>> while I waited for the process to complete. What is the proper way to "do
>> nothing" in emacs?
> 
> Well, `sleep-for' is quite close to "do nothing" I suppose, but I don't
> think that's what you want -- you want the process to run and other
> stuff to happen when the process finishes, so just staring at the screen
> until then seems a more appropriate "do nothing" implementation here.
> 
> I also don't think a keyboard macro is suitable for what you're doing.
> You will at least need to bind some variable(s) around the `grep'
> invocation, and the only way I can think of to do that with a keyboard
> macro only would be something like M-:, which would be crazy. Why don't
> you just define a command and bind it to a key?

Well... I was trying to gently steer you to the errors of your ways
but you seem to be missing the light.

First, you missed the point that I was using grep.  Instead you said I
should be using a synchronous process.  You missed that I wasn't
writing the code that started the process but using a pre-existing
and commonly used routine.

Thus, I could not reach in and change from async to sync.  I had to
ask that on a follow up question (which was trying to gently get you
to discover that you had not suggested anything useful).  It appeared
to me as if you had not read my original post.  I hoped, perhaps, you
would go back and re-read it.  You definitely seem to have missed
the complexity of what I had accomplished.

The second problem is, ok.... suppose I write a sentinels and it will tell
me when the process is done... Now what do I do?  I write a wrapper
that does nothing until that sentinel tells me its ok to proceed.  You have
only added another layer and accomplished nothing.

According to (info "(elisp)Sentinels"), the best way to do
nothing is accept-process-output -- which is what I had and is also
really the only key question.  That should have clued you in.
But no, you still keep coming.  So...

So... third: it is fairly common (for me) to do M-: (translated from <escape> :)
inside a macro and put in some lisp code to set variables or do whatever
you need.  It may not be neat and tidy but it gets the job done.

I did write a small glue function in *scratch* but that is mostly beside
the point.  In the keyboard function, I used straight lisp.  Happens all
the time.

So, lets review: my original post wasn't asking for help on how to do it -- I 
had
already accomplished what I wanted to do.  I was asking if there was a
better way.  You offered a rather stern judgement but still have not
offered a better way.

None of these things appears to have occurred to you.

Hope this helps
pedz




reply via email to

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