[Top][All Lists]

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

Re: Distinguishing between interactive and asynchronous shell buffers

From: Perry Smith
Subject: Re: Distinguishing between interactive and asynchronous shell buffers
Date: Tue, 22 Feb 2011 13:59:41 -0600

On Feb 22, 2011, at 12:48 PM, Sean McAfee wrote:

Perry Smith <address@hidden> writes:
In article <address@hidden>, Sean McAfee <address@hidden>
What's the best way to distinguish asynchronous shell command buffers
from interactive shell buffers?

mode-name ?

It would be "Shell" for things started with "shell" and "Fundamental" for things done with shell-command

I hadn't known of that variable, but a quick test shows that its value
is also "Shell" in the buffer *Async Shell Command* after a
shell-command of "ls &".

Hmm... your are right:

If COMMAND ends in ampersand, execute it asynchronously.
The output appears in the buffer `*Async Shell Command*'.
That buffer is in shell mode.


So, my (oh dear, I just walked into an awful pun) advice at this point
is to look at "advice" in the lisp manual.  I've never used it but
it seems to allow you to wrap a function with some extra code.  In
that code, maybe set a buffer local variable that you could later test.

The other alternatives would be not to use & for shell-commands or look
at mode-name first.  If it is shell then look at the buffers name and
if it isn't "Async ... whatever", then its an interactive shell buffer.

Sorry to be so vague.

reply via email to

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