Collin Bell
Collin Bell

Reputation: 583

Emacs term pastes strange line into terminal when changing directories

I am using fish terminal inside of Emacs term

My normal prompt on load looks like the following

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

$> 

Ok, when I load fish term inside of term.el it looks like this

Welcome to fish, the friendly interactive shell
Type helpB for instructions on how to use fish
7;file://Collins-MacBook-Air.local/Users/collinbell/Programs/riddley⏎    

$> 

A cd command in my normal terminal looks like this

$> cd ~/
$>

However in the emacs term.el it looks like this

$> cd ~/
7;file://Collins-MacBook-Air.local/Users/collinbell⏎             
$> 

I have no idea why it is pasting the cwd into the buffer, but it does it every time a directory changes. Emacs also makes the system sound after this, while other commands like ls do not make the system sound.

This is obviously not the biggest issue in the world, but I do run clear as a pre-command to keep my terminal looking clean (although I turned it off for this example) and Emacs pasting this line into the buffer really messes with sublime usage.

Upvotes: 2

Views: 101

Answers (1)

elethan
elethan

Reputation: 16993

You seem to be experiencing a known issue.

Try this fix:

In your fish config file ~/.config/fish/config.fish add the following:

function fish_title
  true
end

Also, see this from the fish documentation, though according to the github issue, the fix suggested in the docs might not work, while the above function does.

According to the fish documentation, this is what's going on:

Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.

Upvotes: 1

Related Questions