unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sean McAfee <eefacm@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Distinguishing between interactive and asynchronous shell buffers
Date: Sun, 20 Feb 2011 16:02:39 -0800	[thread overview]
Message-ID: <m2y65ajluo.fsf@gmail.com> (raw)

I find that dired is a much better way of navigating around a large
directory hierarchy than staying in my shell buffer and issuing lots of
cd/ls commands.  To bring my shell buffer to a directory I've located
with dired, I wrote an interactive command
bring-last-shell-buffer-to-this-directory (aliased to "c'mere") which
locates the most-recently-used shell buffer like this:

  (let ((buffer (or (loop for buffer being the buffers
                          if (with-current-buffer buffer 
                               (eq major-mode 'shell-mode))
                          return buffer)
                    (error "No shell buffers!"))))
    ;; Issue a "cd" command in buffer that sends that shell
    ;; to the starting buffer's default-directory

This works great most of the time, but once I started an asynchronous
shell command after moving around in dired, and when I did M-x c'mere,
my routine tried to send a cd to the *Async Shell Command* buffer.

What's the best way to distinguish asynchronous shell command buffers
from interactive shell buffers?


             reply	other threads:[~2011-02-21  0:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21  0:02 Sean McAfee [this message]
2011-02-21  2:43 ` Distinguishing between interactive and asynchronous shell buffers 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
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=m2y65ajluo.fsf@gmail.com \
    --to=eefacm@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).