From: Perry Smith <pedzsan@gmail.com>
To: "Štěpán Němec" <stepnem@gmail.com>
Cc: help-gnu-emacs List <help-gnu-emacs@gnu.org>
Subject: Re: waiting for asynchronous processes
Date: Sun, 16 Oct 2011 07:49:28 -0500 [thread overview]
Message-ID: <1A429CBB-4E91-427F-B556-5DF1224C435E@gmail.com> (raw)
In-Reply-To: <878volz47v.fsf@gmail.com>
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
next prev parent reply other threads:[~2011-10-16 12:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-15 17:20 waiting for asynchronous processes Perry Smith
2011-10-15 22:24 ` Štěpán Němec
2011-10-16 0:17 ` Perry Smith
2011-10-16 1:15 ` Štěpán Němec
2011-10-16 1:49 ` Perry Smith
2011-10-16 9:16 ` Štěpán Němec
2011-10-16 12:49 ` Perry Smith [this message]
2011-10-16 9:21 ` Thien-Thi Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1A429CBB-4E91-427F-B556-5DF1224C435E@gmail.com \
--to=pedzsan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=stepnem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.