Thanks for your reply. I tried not enabling shell integration inside emacs by putting this at the end of my .bashrc file, to avoid sourcing shell integration when inside emacs (as indicated by a convenient env. variable called INSIDE_EMACS).
echo "INSIDE_EMACS='$INSIDE_EMACS'"
if [ -z "$INSIDE_EMACS" ]
then
echo "Not inside emacs so enabling shell integration"
export ITERM2_SQUELCH_MARK=1
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
else
echo "Inside emacs so NOT enabling shell integration"
fi
Here's the output from the emacs shell:
INSIDE_EMACS='29.1,term:0.96'
Inside emacs so NOT enabling shell integration
bash: __bp_precmd_invoke_cmd: command not found
bash: __iterm2_prompt_command: command not found
bash: __bp_interactive_mode: command not found
Air:~$
So I'm no longer getting a trashy prompt, but I get those three bash errors before every prompt. Is there something additional I should do? I suspect something's being inherited from the shell I was in when I executed emacs.