help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Distinguishing between interactive and asynchronous shell buffers


From: Sean McAfee
Subject: Re: Distinguishing between interactive and asynchronous shell buffers
Date: Tue, 22 Feb 2011 13:18:25 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Following myself up...

Sean McAfee <address@hidden> 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.


reply via email to

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