From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.help Subject: Re: Distinguishing between interactive and asynchronous shell buffers Date: Tue, 22 Feb 2011 13:59:41 -0600 Message-ID: <0CBD7E1B-BC45-47E1-AEB8-43979C31D650@gmail.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: multipart/alternative; boundary=Apple-Mail-2-122518304 X-Trace: dough.gmane.org 1298404854 29702 80.91.229.12 (22 Feb 2011 20:00:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2011 20:00:54 +0000 (UTC) To: GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 22 21:00:50 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PryPE-00072C-5N for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2011 21:00:49 +0100 Original-Received: from localhost ([127.0.0.1]:34855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PryP0-0002pW-Hz for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2011 15:00:06 -0500 Original-Received: from [140.186.70.92] (port=47373 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PryOh-0002op-CN for help-gnu-emacs@gnu.org; Tue, 22 Feb 2011 14:59:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PryOg-0005v1-0O for help-gnu-emacs@gnu.org; Tue, 22 Feb 2011 14:59:47 -0500 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:57024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PryOf-0005us-S4 for help-gnu-emacs@gnu.org; Tue, 22 Feb 2011 14:59:45 -0500 Original-Received: by vxc38 with SMTP id 38so2051109vxc.0 for ; Tue, 22 Feb 2011 11:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:mime-version:content-type:subject:date :in-reply-to:to:references:message-id:x-mailer; bh=w91/4jr8S5hIPW8qJZgMTKaw0BPwoGzRMOnD912aIVI=; b=ZsQP13qFoSRsvGGvR4Fx7TIoe49qPpbAOOoL1ed8/QNR0Ccyc2b8iEf5g9QOn8LTRA Qo2sp0iYaSJbyIPuKfVQfIjujy+I+Ipa88nOMfKyNUEkF+Yz3uQCJxMKB0JpKIoC2yFn /J4m/wrNQPG+Zd0aW1fEx9KgPbbETniJ02B0o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; b=Oyv7T7fiasyDrBflxNa0jE8rJAmtaqKIYpAE1jkxZVEX12h92fIAxX5oCw5AoBmIgK g4ivDildxXesO3WhLfQedCYRXXmW5tAMG6Nbr3esAUobeqQFxUFnXC+OPycnR/LWYmNq VcRRBOJgDQpzSBWwpLl2brmo5YFZzpnVc2AIE= Original-Received: by 10.52.167.42 with SMTP id zl10mr4663057vdb.299.1298404784401; Tue, 22 Feb 2011 11:59:44 -0800 (PST) Original-Received: from newtoy.austin.ibm.com ([32.97.110.54]) by mx.google.com with ESMTPS id u4sm3115938vch.12.2011.02.22.11.59.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Feb 2011 11:59:43 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.1082) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79350 Archived-At: --Apple-Mail-2-122518304 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Feb 22, 2011, at 12:48 PM, Sean McAfee wrote: > Perry Smith writes: >>>> In article , Sean McAfee = =20 >>>> wrote: >>>>> What's the best way to distinguish asynchronous shell command = buffers >>>>> from interactive shell buffers? >=20 >> mode-name ? >>=20 >> It would be "Shell" for things started with "shell" and "Fundamental" = for things done with shell-command >=20 > 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 --Apple-Mail-2-122518304 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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

= --Apple-Mail-2-122518304--