FredDeschenes / prm-fish

Port of https://github.com/eivind88/prm for the fish shell
MIT License
6 stars 0 forks source link

colliding prompt changes virtuelenv & fish #3

Open weltoph opened 8 years ago

weltoph commented 8 years ago

Hello,

I encountered a problem when using prm-fish to start a virtualenv environment. When sourcing the activate.fish script of the virtualenv from the prm-start-script the following errors occur:

functions: Function “_old_fish_prompt” already exists. Cannot create copy “fish_prompt”
venv/bin/activate.fish (line 50):     functions -c fish_prompt _old_fish_prompt
                                      ^
from sourcing file venv/bin/activate.fish
    called on line 151 of file /usr/share/fish/config.fish

in function “.”
    called on line 4 of file ~/.prm-fish/example/start.fish

from sourcing file ~/.prm-fish/example/start.fish
    called on line 151 of file /usr/share/fish/config.fish

in function “.”
    called on line 277 of file ~/src/fish/prm-fish/prm.fish

in function “__prm_start”
    called on line 1 of file -
    with parameter list “example”

from sourcing file -
    called on line 60 of file /usr/share/fish/functions/eval.fish

in function “eval”
    called on line 27 of file ~/src/fish/prm-fish/prm.fish

in function “prm”
    called on standard input
    with parameter list “start example”

       functions -- print or erase functions

   Synopsis
       functions [ -a | --all ] [ -n | --names ]
       functions -c OLDNAME NEWNAME
       functions -d DESCRIPTION FUNCTION
       functions [ -e | -q ] FUNCTIONS...

functions: Type “help functions” for related documentation

and on deactivating the virtuelenv from the prm-stop-script the following occurs:

functions: Function “_old_fish_prompt” does not exist
venv/bin/activate.fish (line 20):         functions -c _old_fish_prompt fish_prompt
                                          ^
in function “deactivate”
    called on line 4 of file ~/.prm-fish/example/stop.fish

from sourcing file ~/.prm-fish/example/stop.fish
    called on line 151 of file /usr/share/fish/config.fish

in function “.”
    called on line 306 of file ~/src/fish/prm-fish/prm.fish

in function “__prm_stop”
    called on line 1 of file -

from sourcing file -
    called on line 60 of file /usr/share/fish/functions/eval.fish

in function “eval”
    called on line 27 of file ~/src/fish/prm-fish/prm.fish

in function “prm”
    called on standard input
    with parameter list “stop”

       functions(B -- print or erase functions

   Synopsis(B
       functions(B [ -a | --all ] [ -n | --names ]
       functions(B -c OLDNAME NEWNAME
       functions(B -d DESCRIPTION FUNCTION
       functions(B [ -e | -q ] FUNCTIONS...

functions: Type “help functions” for related documentation

It appears that there is a name collision of _old_fish_prompt from both scripts. A workaround is to set the VIRTUAL_ENV_DISABLE_PROMPT environment variable which prevents virtual environments from changing your prompt, but I guess it would me more pleasing to avoid this name clashes. I don't know enough about fish yet to do so, but I hope someone can do so.

Best, Christoph

FredDeschenes commented 8 years ago

Woah, sorry about the delay responding, I never got any notification that an issue was added!

I'll look into it this weekend, but I'm guessing just changing the name of "_old_fish_prompt" to something else more "prm specific" should do the trick.

By the way, you should look into VirtualFish if you want to use virtualenvs on the fish shell, I've never had this issue using it!

EDIT: I've just made a commit that should fix the issue (check out the "fix-old-fish-prompt-name-collision" branch), would you mind trying it?