[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Distinguishing between interactive and asynchronous shell buffers
From: |
Barry Margolin |
Subject: |
Re: Distinguishing between interactive and asynchronous shell buffers |
Date: |
Sun, 20 Feb 2011 21:43:45 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <m2y65ajluo.fsf@gmail.com>, Sean McAfee <eefacm@gmail.com>
wrote:
> 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?
Why not just look for the buffer named "*shell*"?
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Re: Distinguishing between interactive and asynchronous shell buffers, Sean McAfee, 2011/02/22