gem_home icon indicating copy to clipboard operation
gem_home copied to clipboard

Issue when pushing current directory (gem_home $PWD)

Open AliSoftware opened this issue 10 years ago • 2 comments

I wanted my GEM_HOME to be in ~/.gem so I put the call to gem_home $HOME in my .zshrc

But given that any new Terminal session already start in ~, then the pushd $HOME command executed by the gem_home_push function, realizing that I'm already in ~, doesn't add the current directory to the pushd stack.

As a result, when calling popd later on line 18, I get this error printed on my terminal:

gem_home_push:popd:18: directory stack empty

This doesn't actually cause any issue in my use case, but can still have consequences:

  • This message is annoying and could alarm people not really knowing what it means (one of my coworker to which I suggested using your script asked me "what does it mean, did I do something wrong?")
  • It could have side-effects when using outside of the rc file, like in the middle of a terminal session.

e.g. if the user used pushd on its own, then later calls gem_home . or gem_home $PWD, then the pushd won't add anything to the stack but the popd will pop to the last pushed directory and mess its pushd stack

~ $ pushd Documents
Documents $ gem_home .
~ $ # I expected to still be in Documents at this point

AliSoftware avatar Nov 03 '15 09:11 AliSoftware

Confirmed, really annoying bug 😦

adrianpacala avatar May 04 '16 09:05 adrianpacala

Looks to be same thing as in #7

aleksandrs-ledovskis avatar Sep 12 '16 17:09 aleksandrs-ledovskis