1

I'm using, at the terminal on my android device, an simple approach to show the path to my location (export PS1="(\w)$ "). However, the \w seems to not be working in emacs shell emulator running inside termux. That is not really a problem, because I know where I am any time I run shell inside emacs. Is there some way to change default bashrc running by emacs, or just set PS1 variable to be "$ " only for emacs?

  • Just as idea: Have you tried uppercase "W" (works for me)? – kai-dj Feb 12 '18 at 4:13
  • No, its still the same problem, I can see the string as I typed in to PS1 not it's execution. – siery Feb 12 '18 at 4:36
  • Oh, I missed the shell-part. "works for me" only in term (stupid me- sorry it's late here ^^) – kai-dj Feb 12 '18 at 4:47
2

You can use the INSIDE_EMACS environment variable. If you genuinely want to restrict it to M-x shell usage, then you might do something like:

case $INSIDE_EMACS in
    *comint*) PS1="$ ";;
esac

I'd recommend figuring out which part of your system is responsible for it not working as expected, though.

Also: Your question was not quite a duplicate of Startup script for term-mode, but you should read that as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.