From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sean McAfee Newsgroups: gmane.emacs.help Subject: Re: Distinguishing between interactive and asynchronous shell buffers Date: Tue, 22 Feb 2011 13:18:25 -0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1298410851 424 80.91.229.12 (22 Feb 2011 21:40:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2011 21:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 22 22:40:46 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 1PrzyN-00049M-H6 for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2011 22:40:43 +0100 Original-Received: from localhost ([127.0.0.1]:48305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrzyL-00067J-6M for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2011 16:40:41 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Tue, 22 Feb 2011 15:18:25 -0600 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:kA8m5NtcKoqVmCN+2ahJjKmNX4A= Original-Lines: 19 Original-X-Trace: sv3-OVcwveHt37RTj5YKApsXuWQsRh1xFK6UcSJyrD1oOr68LN0gAU8dx3YPVVjLFWZkhhPnijcNJBWORP2!3RpeS4+GmUXbyKDCbDYxZGOeyBAHBeLaIjBeX2vxujKUBDNmeV4xKzld/GapSxURewXq1jQ0f1lK!DTtbbnRcNWTlhRl0+In5mgVg Original-X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1927 Original-Xref: usenet.stanford.edu gnu.emacs.help:185198 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:79356 Archived-At: Following myself up... Sean McAfee writes: > What's the best way to distinguish asynchronous shell command buffers > from interactive shell buffers? Digging into simple.el, the only difference I could find between asynchronous and interactive shell buffers is that the former have process sentinels associated with them when they're running; after they finish, they of course have no process at all. That led me to write: (defun is-interactive-shell-buffer (buffer) (and (with-current-buffer buffer (eq major-mode 'shell-mode)) (let ((proc (get-buffer-process buffer))) (and proc (not (process-sentinel proc)))))) I guess this solution could fail if an interactive shell buffer ever had a process sentinel for some reason, but it seems OK for now.