1

Summary

The first line of shell-mode has an extra bash-3.2$ prompt before my custom dotfiles (master)$ prompt.

I tried writing PROMPT_COMMAND='' in my ~/.bashrc according to an earlier Stack Overflow post, but bash-3.2$ continues to display anyway.

Steps to reproduce

$ emacs
M-x shell-mode RET

Expected

dotfiles (master)$ RET
dotfiles (master)$ RET
dotfiles (master)$ RET

Observed

bash-3.2$ dotfiles (master)$ RET
dotfiles (master)$ RET
dotfiles (master)$ RET

Configuration

System

$ specs emacs bash brew os
specs --version
0.19

emacs --version
GNU Emacs 24.4.1
Copyright (C) 2014 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.

brew --version
0.9.5

system_profiler SPSoftwareDataType | grep 'System Version'
    System Software Overview:
      System Version: OS X 10.10.3 (14D136)

Also posted on Reddit.

2 Answers 2

0

Remove \v or \V from your PS1 variable.

http://ss64.com/bash/syntax-prompt.html

1
  • You are correct, PS1 is briefly set to \s-\v\$, and printed, before my shell configuration finishes setting it to \W$(__git_ps1 " (%s)")$. On a related note, I've noticed that shell-mode often prints a prompt before waiting for programs to finish running.
    – mcandre
    May 4, 2015 at 22:04
0

Turns out I was loading my git prompt with .bash_profile, but not with .bashrc, after I had changed the load style of my bash configuration for speed.

I've created https://github.com/mcandre/dotfiles/blob/master/.bashrc.d/emacs-git-prompt.sh to get the best of both worlds: fast shells, and idiomatic Emacs shell prompts!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .