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

prompt_sorin_precmd_async:local:13: not valid in this context: -A #1384

Closed
unphased opened this issue Jul 17, 2017 · 13 comments
Closed

prompt_sorin_precmd_async:local:13: not valid in this context: -A #1384

unphased opened this issue Jul 17, 2017 · 13 comments

Comments

@unphased
Copy link

unphased commented Jul 17, 2017

This error

prompt_sorin_precmd_async:local:13: not valid in this context: -A

is appended to each new prompt on macOS Sierra after updating to recent commit on master.

modules/prompt/functions/prompt_sorin_setup:66 which is line 13 of prompt_sorin_precmd_async is:

local tmp_prompt_var=$(typeset -p git_info)
@unphased
Copy link
Author

unphased commented Jul 17, 2017

I do have a terminal that has been long-running and has old zsh configuration. There is a difference: The working code returns for typeset -p git_info

typeset -A git_info
git_info=(status '$(coalesce " %B%F{2}master%f%b" "" " %B%F{3}aac4f7b%f%b") %B%F{7}◼%f%b' )

and this correlates with whether i'm in a git repo and its state, naturally.

In the new code, the result is

typeset: no such variable: git_info

also probably coming over stderr so it doesn't get slurped up at all...

So I don't know what is different but this isn't working right on Sierra. Everything's fine in Ubuntu.

@belak
Copy link
Collaborator

belak commented Jul 17, 2017

There are a myriad of issues with how async is implemented in the sorin prompt. I have an experimental prompt I've been using which is based off the sorin prompt to learn zsh-async (https://github.com/belak/dotfiles/blob/master/belak/zsh/prompt_belak_setup) but I've got a few tweaks to make before the sorin prompt can be updated to match. It should fix this issue (among other things).

@unphased
Copy link
Author

unphased commented Jul 17, 2017

Trying set -x now
Ubuntu:

+git-info:56> local stashed_formatted
+git-info:57> local status_cmd
+git-info:58> local status_mode
+git-info:59> local unindexed=0
+git-info:60> local unindexed_format
+git-info:61> local unindexed_formatted
+git-info:62> local unmerged=0
+git-info:63> local unmerged_format
+git-info:64> local unmerged_formatted
+git-info:65> local untracked=0
+git-info:66> local untracked_format
+git-info:67> local untracked_formatted
+git-info:70> unset git_info
+git-info:71> typeset -gA git_info
+git-info:74> git rev-parse --is-inside-work-tree
+git-info:74> is-true ''
+is-true:1> [[ -n '' ]]
+git-info:75> return 1
zsh: write error
+prompt_sorin_precmd:1> setopt LOCAL_OPTIONS
+prompt_sorin_precmd:2> unsetopt XTRACE KSH_ARRAYS
+_zsh_highlight_main__precmd_hook:1> _zsh_highlight_main__command_type_cache=( )
slu@ubuntu-sluvm ~ ❯❯❯ +-zsh:1> prompt_sorin_git_info                                                        ⏎
+prompt_sorin_git_info:1> ((  _prompt_sorin_precmd_async_pid > 0  ))
+prompt_sorin_git_info:3> [[ -s /tmp/zsh-1000/sorin-prompt-async-zfpylrgPfn ]]
+prompt_sorin_git_info:4> alias 'typeset=typeset -g'
+prompt_sorin_git_info:5> source /tmp/zsh-1000/sorin-prompt-async-zfpylrgPfn
+/tmp/zsh-1000/sorin-prompt-async-zfpylrgPfn:1> typeset -g -g -A git_info=( )
+prompt_sorin_git_info:6> RPROMPT+='${git_info:+${(e)git_info[status]}}'
+prompt_sorin_git_info:7> unalias typeset
+prompt_sorin_git_info:11> _prompt_sorin_precmd_async_pid=0
+prompt_sorin_git_info:14> zle
+prompt_sorin_git_info:14> zle reset-prompt
slu@ubuntu-sluvm ~ ❯❯❯

Sierra:

+git-info:56> local stashed_formatted
+git-info:57> local status_cmd
+git-info:58> local status_mode
+git-info:59> local 'unindexed=0'
+git-info:60> local unindexed_format
+git-info:61> local unindexed_formatted
+git-info:62> local 'unmerged=0'
+git-info:63> local unmerged_format
+git-info:64> local unmerged_formatted
+git-info:65> local 'untracked=0'
+git-info:66> local untracked_format
+git-info:67> local untracked_formatted
+git-info:70> unset git_info
+git-info:71> typeset -gA git_info
+git-info:74> git rev-parse --is-inside-work-tree
+git-info:74> is-true ''
+is-true:1> [[ -n '' ]]
+git-info:75> return 1
+prompt_sorin_precmd:1> setopt LOCAL_OPTIONS
+prompt_sorin_precmd:2> unsetopt XTRACE KSH_ARRAYS
+_zsh_highlight_main__precmd_hook:1> _zsh_highlight_main__command_type_cache=( )
~ ❯❯❯ prompt_sorin_precmd_async:local:13: not valid in this context: -A                           ⏎

Does not appear to be enough evidence for anything. gonna do more set -x in places.

@unphased
Copy link
Author

I'm seeing this on Sierra:

+prompt_sorin_precmd_async:14> typeset -p git_info
+prompt_sorin_precmd_async:14> local 'tmp_prompt_var=typeset' -A git_info 'git_info=()'
prompt_sorin_precmd_async:local:14: not valid in this context: -A

ubuntu...

+prompt_sorin_precmd_async:14> typeset -p git_info
+prompt_sorin_precmd_async:14> local tmp_prompt_var='typeset -g -A git_info=( )'
+prompt_sorin_precmd_async:16> tmp_prompt_var='typeset -g -A git_info=( )'
+prompt_sorin_precmd_async:18> tmp_prompt_var='typeset -g -A git_info=( )'
+prompt_sorin_precmd_async:20> tmp_prompt_var='typeset -g -A git_info=( )'
+prompt_sorin_precmd_async:21> printf '%s\n' 'typeset -g -A git_info=( )'
+prompt_sorin_precmd_async:25> kill -WINCH 121362

@unphased
Copy link
Author

@belak is there another prompt that has almost as many features that is more stable?

@belak
Copy link
Collaborator

belak commented Jul 17, 2017

Right now, I'm not sure... I'm partial to agnoster, but that has a known potential security hole in it and we need to decide how to handle it... I'll hopefully have a fix for sorin some time today though.

@unphased
Copy link
Author

Alright. I've switched to paradox theme. It's got some quirks with its completion helper printing though.

@belak
Copy link
Collaborator

belak commented Jul 18, 2017

There's a potential fix in the PR which I just opened. :) Feel free to check it out and let me know if you still have problems with it.

@unphased
Copy link
Author

running your PR now. seems good so far

@crivotz
Copy link

crivotz commented Jul 20, 2017

I have the same problem in Debian 8.8 zsh 5.0.7
I tried the PR #1385 but I get the following messages:

prompt_sorin_precmd:8: command not found: async_flush_jobs                                                                                                                                        
prompt_sorin_precmd:19: command not found: async_job

@belak
Copy link
Collaborator

belak commented Jul 20, 2017

When you switched to the other branch did you make sure submodules were updated?

@unphased
Copy link
Author

@crivotz I encountered the same, @belak's suggestion to update the submodules is exactly right. git submodule update --init --recursive

@crivotz
Copy link

crivotz commented Jul 20, 2017

@belak @unphased Thanks all works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants