1
tcsh$ cd ~
^[]0;sallred@calamity:/home/sallred^G
tcsh$ cd bin
^[]0;sallred@calamity:/home/sallred/bin^G
tcsh$ 

What is this cruft that is appearing before my prompt (or perhaps more appropriately, after my command) and how can I remove it?

  • 1
    Perhaps too obvious, but are you setting prompt in your .cshrc (or equivalent) file? – glucas Nov 12 '14 at 15:27
  • @glucas set prompt "\ntcsh$ " This stuff only appears from within emacs. Additionally, there is nothing in my rc file that matches this general pattern: .*:.*@.*. – Sean Allred Nov 12 '14 at 15:34
  • 2
    Just a guess: Is your shell trying to set the xterm window title? – Constantine Nov 12 '14 at 16:31
  • @Constantine That's exactly what it's doing. I've removed the problem statement for now (alias precmd 'echo -n "\033]0;${USER}@${HOST}:${PWD}\007"'), but is there any way to get Emacs to ignore or override this? – Sean Allred Nov 12 '14 at 16:43
  • I'm tempted to make a new question along the lines of "use a different shell rc file for emacs" and dupe this to that; it seems like the general case might be more useful for search engines. – Sean Allred Nov 12 '14 at 16:47
1

You might want to look at this question. Basically you need to avoid creating aliases for commands or prompts that assume that every shell is running where there is a window title to be set. Or create functions that do things differently depending on what kind of terminal they find themselves in.

As part of my bash initialization I do something like:

case "$TERM" in
    (emacs)
        # Emacs shell differences ...
        ;;
    (xterm*|dtterm*|linux|screen)
        # Embed working directory in window title
        PROMPT_COMMAND='echo -ne "\033]0;${SSH_TTY:+${HOSTNAME%%.*}:}${PWD##*/}\007"'
        ;;
    *)
        # Unrecognized terminal types get nothing
        ;;
esac

You need tcsh's precmd to do something equivalent.

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.