unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Perry Smith <pedzsan@gmail.com>
To: GNU Emacs List <help-gnu-emacs@gnu.org>
Subject: Re: Distinguishing between interactive and asynchronous shell buffers
Date: Tue, 22 Feb 2011 13:59:41 -0600	[thread overview]
Message-ID: <0CBD7E1B-BC45-47E1-AEB8-43979C31D650@gmail.com> (raw)
In-Reply-To: <bp8sjvfvray.fsf@usca1uw-JZWWPM1.sanmateo.corp.akamai.com>

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]


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

> Perry Smith <pedzsan@gmail.com> writes:
>>>> In article <m2y65ajluo.fsf@gmail.com>, Sean McAfee <eefacm@gmail.com> 
>>>> wrote:
>>>>> 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.


bummer.

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.
pedz


[-- Attachment #2: Type: text/html, Size: 2773 bytes --]

  reply	other threads:[~2011-02-22 19:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21  0:02 Distinguishing between interactive and asynchronous shell buffers Sean McAfee
2011-02-21  2:43 ` Barry Margolin
2011-02-22  0:24   ` Sean McAfee
2011-02-22  0:50     ` Perry Smith
     [not found]     ` <mailman.7.1298335846.7153.help-gnu-emacs@gnu.org>
2011-02-22 18:48       ` Sean McAfee
2011-02-22 19:59         ` Perry Smith [this message]
2011-02-22 21:18 ` Sean McAfee
2011-02-23 16:03   ` Stefan Monnier
2011-02-23 18:28     ` Deniz Dogan

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0CBD7E1B-BC45-47E1-AEB8-43979C31D650@gmail.com \
    --to=pedzsan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).