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

some command is executed without pressing enter when zsh-autocomplete enable #318

Closed
tshu-w opened this issue Aug 7, 2021 · 7 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@tshu-w
Copy link

tshu-w commented Aug 7, 2021

  • zsh-autocomplete version:
  • Zsh version: zsh-5.8-0-g77d203f
  • Framework: none
  • Plugin manager: Znap
  • Operating system: darwin20.0
  1. Paste the following into your terminal and press Enter:
    cd $(mktemp -d)
    git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
    print 'PS1="%# " PS2="  " RPS2="< %^"; setopt transientrprompt
    source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
    export PATH=/Users/wangtianshu/.local/bin:$PATH # add path for ec
    ' > .zshrc
    SHELL==zsh
    exec -c zsh -fc "HOME=$PWD SHELL=$SHELL TERM=$TERM exec $SHELL -d"
  2. Once you're able to reproduce your problem in the shell session created
    above, copy-paste the contents of your terminal here:
    ec # type ec and space, focus on Emacs

Here is the content of my ec.
And here is a gif, you can see when I type ec and space, I switch focus to Emacs. This usually happens the first time I enter when I start a new zsh session.
Kapture 2021-08-07 at 12 06 45

@tshu-w tshu-w added the bug Something isn't working label Aug 7, 2021
@K4LCIFER
Copy link

K4LCIFER commented Aug 7, 2021

I have encountered the same issue with KiCAD. I'm guessing zsh is running kicad --help in the background to get the options list, but KiCAD doesn't have a help option, so just typing kicad ends up opening a file called --help in KiCAD.

@tshu-w
Copy link
Author

tshu-w commented Aug 7, 2021

Thanks for the tip, it seems to be the case, I'll try to add special handling for --help.

@tshu-w
Copy link
Author

tshu-w commented Aug 7, 2021

Thx @K4LCIFER, adding special judgments solves this issue.

# Don't change focus with --help
if [ "$1" = "--help" ]; then
    emacsclient --help
    exit 0
fi

Other tips are welcome.

@tshu-w tshu-w closed this as completed Aug 7, 2021
@marlonrichert marlonrichert reopened this Aug 7, 2021
@marlonrichert marlonrichert self-assigned this Aug 7, 2021
@marlonrichert
Copy link
Owner

I'm guessing zsh is running kicad --help in the background to get the options list

@K4LCIFER Yes, that is exactly the case. I will have to remove that code and think if there’s a better way to handle that.

@marlonrichert
Copy link
Owner

@K4LCIFER @tshu-w Would perhaps some kind of blacklist feature be sufficient?

@marlonrichert
Copy link
Owner

Another idea would be to allow you to override per command how we should fetch help.

@tshu-w
Copy link
Author

tshu-w commented Aug 7, 2021

I think these two can be combined into one, if the override is left blank that is disabled.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants