unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* shell-popd-regexp not working?
@ 2013-05-04 23:23 Chad Brown
  2013-05-05  1:09 ` Barry Margolin
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Chad Brown @ 2013-05-04 23:23 UTC (permalink / raw)
  To: help-gnu-emacs

I've long used the alias `bd' for popd, but I've never bothered to
make it work in emacs' shell mode before. Today, I ran into the
issue again, and I decided to fix it. After looking at the doc, I
customized shell-popd-regexp from `popd' to `bd'. It doesn't seem
to do what I thought it should do: if I use `bd' in a shell buffer,
emacs does not change the current directory.

Am I doing something wrong here?  I'm not very familiar with
shell-mode.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell-popd-regexp not working?
  2013-05-04 23:23 shell-popd-regexp not working? Chad Brown
@ 2013-05-05  1:09 ` Barry Margolin
  2013-05-05  1:23 ` J. David Boyd
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Barry Margolin @ 2013-05-05  1:09 UTC (permalink / raw)
  To: help-gnu-emacs

In article <3d754520-0cd8-4183-a01e-894c47c4cf0f@googlegroups.com>,
 Chad Brown <yandros@gmail.com> wrote:

> I've long used the alias `bd' for popd, but I've never bothered to
> make it work in emacs' shell mode before. Today, I ran into the
> issue again, and I decided to fix it. After looking at the doc, I
> customized shell-popd-regexp from `popd' to `bd'. It doesn't seem
> to do what I thought it should do: if I use `bd' in a shell buffer,
> emacs does not change the current directory.
> 
> Am I doing something wrong here?  I'm not very familiar with
> shell-mode.

Does it properly update when you use "cd", "pushd", etc.? If not, maybe 
your prompt doesn't match the pattern for that.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell-popd-regexp not working?
  2013-05-04 23:23 shell-popd-regexp not working? Chad Brown
  2013-05-05  1:09 ` Barry Margolin
@ 2013-05-05  1:23 ` J. David Boyd
  2013-05-05  2:39 ` Drew Adams
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: J. David Boyd @ 2013-05-05  1:23 UTC (permalink / raw)
  To: help-gnu-emacs

Chad Brown <yandros@gmail.com> writes:

> I've long used the alias `bd' for popd, but I've never bothered to
> make it work in emacs' shell mode before. Today, I ran into the
> issue again, and I decided to fix it. After looking at the doc, I
> customized shell-popd-regexp from `popd' to `bd'. It doesn't seem
> to do what I thought it should do: if I use `bd' in a shell buffer,
> emacs does not change the current directory.
>
> Am I doing something wrong here?  I'm not very familiar with
> shell-mode.

That sounds like a nice function, I'd like to see it work too.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: shell-popd-regexp not working?
  2013-05-04 23:23 shell-popd-regexp not working? Chad Brown
  2013-05-05  1:09 ` Barry Margolin
  2013-05-05  1:23 ` J. David Boyd
@ 2013-05-05  2:39 ` Drew Adams
  2013-05-05  3:39 ` Chad Brown
       [not found] ` <mailman.25142.1367721572.855.help-gnu-emacs@gnu.org>
  4 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2013-05-05  2:39 UTC (permalink / raw)
  To: 'Chad Brown', help-gnu-emacs

> I've long used the alias `bd' for popd...

[O-T: Interesting.  A zillion years ago I chose `u' for `pushd', `o' for `popd',
and `uo' for `pushd; popd' (i.e., remove 2nd entry - since `pushd' with no arg
swaps), and I've never looked back.]

Can't help much with the Emacs question; sorry.  For me, `o' and the rest work
as usual in an Emacs shell buffer (with no customizations, e.g.,
`shell-popd-regexp' is just the default, "popd").

Does using `(o; ls bo*)' count as using `popd' in a subshell?  If so, then that
too works for me.  (I use Cygwin `bash' with Emacs on Windows.)




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell-popd-regexp not working?
  2013-05-04 23:23 shell-popd-regexp not working? Chad Brown
                   ` (2 preceding siblings ...)
  2013-05-05  2:39 ` Drew Adams
@ 2013-05-05  3:39 ` Chad Brown
  2013-05-05  3:51   ` Barry Margolin
       [not found] ` <mailman.25142.1367721572.855.help-gnu-emacs@gnu.org>
  4 siblings, 1 reply; 8+ messages in thread
From: Chad Brown @ 2013-05-05  3:39 UTC (permalink / raw)
  To: help-gnu-emacs

Short form: Pilot error; problem resolved.

On Saturday, May 4, 2013 4:23:04 PM UTC-7, Chad Brown wrote:
> if I use `bd' in a shell buffer, emacs does not change the current directory.

I think I've said something confusing; let me try again:

If I use `bd' in a shell buffer, the current directory for the shell changes, but emacs doesn't realize it changed (shell-mode normally tracks the shell's cwd so that it becomes the default for emacs file operations from that buffer).

The problem seems to be that I didn't also set shell-popd-regexp, so shell-mode didn't realize I was pushing directories onto the stack. Setting both regexp seems to DTRT. 

Thanks, everyone!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell-popd-regexp not working?
  2013-05-05  3:39 ` Chad Brown
@ 2013-05-05  3:51   ` Barry Margolin
  0 siblings, 0 replies; 8+ messages in thread
From: Barry Margolin @ 2013-05-05  3:51 UTC (permalink / raw)
  To: help-gnu-emacs

In article <3ba721a1-46fb-4aef-bb7d-91495234998f@googlegroups.com>,
 Chad Brown <yandros@gmail.com> wrote:

> The problem seems to be that I didn't also set shell-popd-regexp, so 
> shell-mode didn't realize I was pushing directories onto the stack. Setting 
> both regexp seems to DTRT. 

I think you mean you didn't also set shell-pushd-regexp. You never said 
that you have a custom pushd as well.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell-popd-regexp not working?
       [not found] ` <mailman.25142.1367721572.855.help-gnu-emacs@gnu.org>
@ 2013-05-05  3:53   ` Barry Margolin
  2013-05-05 13:23     ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Margolin @ 2013-05-05  3:53 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.25142.1367721572.855.help-gnu-emacs@gnu.org>,
 "Drew Adams" <drew.adams@oracle.com> wrote:

> > I've long used the alias `bd' for popd...
> 
> [O-T: Interesting.  A zillion years ago I chose `u' for `pushd', `o' for 
> `popd',
> and `uo' for `pushd; popd' (i.e., remove 2nd entry - since `pushd' with no 
> arg
> swaps), and I've never looked back.]
> 
> Can't help much with the Emacs question; sorry.  For me, `o' and the rest 
> work
> as usual in an Emacs shell buffer (with no customizations, e.g.,
> `shell-popd-regexp' is just the default, "popd").

If you don't customize it, how does Emacs know that you've changed 
directories? It needs to emulate the directory changes so that filename 
completion works.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: shell-popd-regexp not working?
  2013-05-05  3:53   ` Barry Margolin
@ 2013-05-05 13:23     ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2013-05-05 13:23 UTC (permalink / raw)
  To: 'Barry Margolin', help-gnu-emacs

> > For me, `o' and the rest work as usual in an Emacs shell
> > buffer (with no customizations, e.g., `shell-popd-regexp'
> > is just the default, "popd").
> 
> If you don't customize it, how does Emacs know that you've
> changed directories? It needs to emulate the directory changes
> so that filename completion works.

Yes; for that you need to set `shell-p(op|ush)d-regexp'.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-05 13:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-04 23:23 shell-popd-regexp not working? Chad Brown
2013-05-05  1:09 ` Barry Margolin
2013-05-05  1:23 ` J. David Boyd
2013-05-05  2:39 ` Drew Adams
2013-05-05  3:39 ` Chad Brown
2013-05-05  3:51   ` Barry Margolin
     [not found] ` <mailman.25142.1367721572.855.help-gnu-emacs@gnu.org>
2013-05-05  3:53   ` Barry Margolin
2013-05-05 13:23     ` Drew Adams

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).