all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* 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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.