On Feb 22, 2011, at 12:48 PM, Sean McAfee wrote: > Perry Smith writes: >>>> In article , Sean McAfee >>>> 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