Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish in emacs' ansi-term has prompt issues #107

Closed
ahyatt opened this issue Jun 11, 2012 · 16 comments
Closed

fish in emacs' ansi-term has prompt issues #107

ahyatt opened this issue Jun 11, 2012 · 16 comments
Labels
bug Something that's not working as intended release notes Something that is or should be mentioned in the release notes
Milestone

Comments

@ahyatt
Copy link

ahyatt commented Jun 11, 2012

Under emacs's ansi-term (probably the only way to get the real power of fish inside of emacs), the prompt looks like:

2;fish /home/ahyatt2;fish /home/ahyatt
ahyatt@ahyatt /home/ahyatt>

My term is eterm-color, which is standard for ansi-term. Probably some of the default ansi control sequences in the prompt are not quite kosher.

@ahyatt
Copy link
Author

ahyatt commented Jun 11, 2012

After I reported this, I happened to notice that this is documented in the original fish documentation, with the fix being: echo 'function fish_title;end' > ~/.config/fish/config.fish

However, that doesn't work for me:

Welcome to fish, the friendly interactive shell
Type helpB for instructions on how to use fish
fish: Unknown function “fish_title”
fish: Unknown function “fish_title”
ahyatt@ahyatt ~>

@Flowdeeps
Copy link

I have exactly the same problem but with iTerm.

The 'fix' didn't work for me either.

@akrito
Copy link

akrito commented Aug 10, 2012

The above fix is close. Adding:

function fish_title
  true
end

to ~/.config/fish/config.fish fixed it for me in Emacs 24.1

@Flowdeeps
Copy link

This is the one.

@ahyatt ahyatt closed this as completed Jun 8, 2013
@jackbravo
Copy link

+1

@ali
Copy link

ali commented Mar 13, 2015

@akrito Thanks! This worked for me, too.

@faho faho added invalid and removed bug Something that's not working as intended labels Feb 8, 2016
@faho faho removed this from the fish-future milestone Feb 8, 2016
@collinalexbell
Copy link

collinalexbell commented Aug 25, 2016

The fish title hack is not working for me. There may be no title, but it is still changing the folder displayed in the tile (when viewed from iterm)

@faho
Copy link
Member

faho commented Aug 25, 2016

@SlightlyCyborg: If you don't use the fish title thing, do you get the folder displayed twice (and only once with it)? If you use it on another terminal, does it work?

iTerm has special integration with shells, and the fish version isn't conditional on the $TERM being iTerm, and it only blacklists screen. By default this file will be saved as ~/.iterm2_shell_integration.fish, so you might want to see what happens when you remove that.

@collinalexbell
Copy link

@faho I only checked it on iterm (turns out it is just macs standard Terminal) to find out why I was still getting a strange line printed on emacs term every time I used cd

7;file://Collins-MacBook-Air.local/Users/collinbell/dameon

Yes, if I remove the fish_title from the config, then I will see the folder appear twice on the mac Terminal app. The same thing still happens in emacs term.

@faho
Copy link
Member

faho commented Aug 25, 2016

@SlightlyCyborg: Run this:

    if test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
        echo "True"
    end

Does it print "true"? In that case, this is our cwd reporting for VTE or Apple Terminal. Since you are running emacs in a terminal that can handle this, we're printing it, but emacs then mangles it so the term no longer gets the full sequence (yet another limitation of ansi-term).

@floam
Copy link
Member

floam commented Aug 25, 2016

We might need to do what Apple does for Emacs:

/etc/bashrc_Apple_Terminal

# Working Directory
#
# Tell the terminal about the current working directory at each prompt.

if [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
    # Identify the directory using a "file:" scheme URL, including
    # the host name to disambiguate local vs. remote paths.

    # Percent-encode the pathname.
    local url_path=''
    {
        # Use LC_CTYPE=C to process text byte-by-byte. Ensure that
        # LC_ALL isn't set, so it doesn't interfere

https://gist.github.com/floam/f535842a16226e77d014d67bade2b2f3

@floam floam added bug Something that's not working as intended and removed will-not-fix labels Aug 25, 2016
@floam floam reopened this Sep 20, 2016
@floam floam added this to the fish 2.4.0 milestone Sep 20, 2016
@floam
Copy link
Member

floam commented Sep 20, 2016

I'm going to add the $INSIDE_EMACS check for the CWD OSC and define an empty fish_title if the user is using VTE/Terminal.app. The reasoning for the latter is that these modern terminals both compose a nicer title if we don't try to provide a custom one (no path in title twice, "fish" in title twice) - and the user can configure which components they'd like in their terminal inside the terminal preferences.

@floam floam closed this as completed in 2c8bc05 Sep 20, 2016
@floam floam added the release notes Something that is or should be mentioned in the release notes label Sep 20, 2016
@floam
Copy link
Member

floam commented Sep 20, 2016

Before and after in Terminal.app (you can configure Terminal.app to show the full path, if you prefer):
messy

cleaner

@rdrey
Copy link

rdrey commented Nov 23, 2016

I got tripped up by the iTerm shell integration. Could we mention that in the readme in the fish section, too?

@faho
Copy link
Member

faho commented Nov 23, 2016

@rdrey: IIRC, iTerm ships that, so you'll have to take it up with them.

@rdrey
Copy link

rdrey commented Nov 23, 2016

Sorry, I was in the completely wrong repo last night. I thought I was commenting on an issue in https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Btools/shell. 😅

I've created a PR for iTerm2 instead. (gnachman/iterm2-website#35)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended release notes Something that is or should be mentioned in the release notes
Projects
None yet
Development

No branches or pull requests

10 participants