hchbaw / auto-fu.zsh

#zsh automatic complete-word and list-choices. Originally incr-0.2.zsh by y.fujii <y-fujii at mimosa-pudica.net>
427 stars 51 forks source link

Error message: with-afu-zle-rebinding:16: command not found: afu-zle-aysce-install and with-afu-zle-rebinding:16: command not found: -zle-force-install #34

Open Firef0x opened 9 years ago

Firef0x commented 9 years ago

こんにちわ~~ @hchbaw 君

The following error are showing up alternately every time I start a new terminal.

$ with-afu-zle-rebinding:16: command not found: afu-zle-aysce-install
$ (Then I could execute whatever command without any error shown)

and

$ with-afu-zle-rebinding:16: command not found: -zle-force-install
$ (Then I could execute whatever command without any error shown)

A bit similar to issue https://github.com/hchbaw/auto-fu.zsh/issues/22 from @joe9 , but I think it's better to make a new issue to report it.

What's more, the following command just outputs a blank line.

$ echo $functions[afu-initialize-rebinds]
[A blank line]
$

How could I fix the error message?

Hope for your reply !!! お愿いします!

FYI

# Path to your oh-my-zsh installation.
ZSH=/usr/share/oh-my-zsh/

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"

DEFAULT_USER="f"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(extract fbterm git history-substring-search systemd svn tmux)

source $ZSH/oh-my-zsh.sh

# User configuration

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

## auto-fu.zsh stuff.
# source ~/codes/auto-fu.zsh/auto-fu.zsh
{ . /home/f/.zsh/auto-fu; auto-fu-install; }
zstyle ':auto-fu:highlight' input bold
zstyle ':auto-fu:highlight' completion fg=black,bold
zstyle ':auto-fu:highlight' completion/one fg=white,bold,underline
zstyle ':auto-fu:var' postdisplay $'\n-azfu-'
zstyle ':auto-fu:var' track-keymap-skip opp
zle-line-init () {auto-fu-init;}; zle -N zle-line-init
zle -N zle-keymap-select auto-fu-zle-keymap-select

# Powerline
. /usr/share/zsh/site-contrib/powerline.zsh

# Customize to your needs...

# Enhanced History Search
bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward
# Emulate 256 color mode only when fbterm is active
[ -n "$FBTERM" ] && export TERM=fbterm
setopt hist_ignore_all_dups
setopt hist_ignore_space
# zsh 4.3.6 doesn't have this option
setopt hist_fcntl_lock 2>/dev/null
setopt hist_reduce_blanks
# vim:filetype=zsh:foldmethod=marker:autoindent:expandtab:shiftwidth=4
hchbaw commented 9 years ago

ハイ、こんにちわ! Mucho gusto @Firef0x . Thank you very much for your detailed report.

Ugh, $functions[afu-initialize-rebinds] will be empty in a zcompiled auto-fu environment.

I suspect something went wrong for generating the ~/.zsh/auto-fu file. How about below command to zcompile auto-fu?

A=/path/to/auto-fu.zsh
(zsh -f -c "setopt extendedglob no_shwordsplit; source $A ; auto-fu-zcompile $A ~/.zsh")
Firef0x commented 9 years ago

Ugh, $functions[afu-initialize-rebinds] will be empty in a zcompiled auto-fu environment.

そうですね !

How about below command to zcompile auto-fu?

Here is the output:

** zcompiling auto-fu in /home/f/.zsh for a little faster startups...
+ mkdir -p /home/f/.zsh
* writing code /home/f/.zsh/auto-fu
* re-compiling /home/f/.zsh/auto-fu.zwc: succeeded
** All done.
** Please update your .zshrc to load the zcompiled file like this,
-- >8 --
## auto-fu.zsh stuff.
# source ~/codes/auto-fu.zsh/auto-fu.zsh
{ . ~/.zsh/auto-fu; auto-fu-install; }
zstyle ':auto-fu:highlight' input bold
zstyle ':auto-fu:highlight' completion fg=black,bold
zstyle ':auto-fu:highlight' completion/one fg=white,bold,underline
zstyle ':auto-fu:var' postdisplay $'\n-azfu-'
zstyle ':auto-fu:var' track-keymap-skip opp
zle-line-init () {auto-fu-init;}; zle -N zle-line-init
zle -N zle-keymap-select auto-fu-zle-keymap-select
-- 8< --

The same error message still shows after executing the command.

Hope for your reply !

hchbaw commented 9 years ago

Thank you very much reporting back!

Does same error still happen if your ~/.zshrc like this instead? (This means don't use zcompiled file.)

(... other stuff)
## auto-fu.zsh stuff.
source ~/codes/auto-fu.zsh/auto-fu.zsh
# { . ~/.zsh/auto-fu; auto-fu-install; }
...

And,

Could you post some portions of ~/.zsh/auto-fu ?

I want to see with-afu-zle-rebinding function in it. It should be something like this:

with-afu-zle-rebinding () {
    local -a restores
    {
        eval "$(afu-rebind-expand restores self-insert; afu-rebind-expand restores backward-delete-char; afu-rebind-expand restores backward-kill-word; afu-rebind-expand restores kill-line; afu-rebind-expand restores kill-whole-line; afu-rebind-expand restores kill-word; afu-rebind-expand restores magic-space; afu-rebind-expand restores yank; afu-rebind-expand restores complete-word; afu-rebind-expand restores list-choices;)"
        afu-zle-force-install () {
            zle -N self-insert self-insert-by-keymap
            zle -N backward-delete-char backward-delete-char-by-keymap
            zle -N backward-kill-word backward-kill-word-by-keymap
            zle -N kill-line kill-line-by-keymap
            zle -N kill-whole-line kill-whole-line-by-keymap
            zle -N kill-word kill-word-by-keymap
            zle -N magic-space magic-space-by-keymap
            zle -N yank yank-by-keymap
            zle -C complete-word .complete-word _main_complete
            zle -C list-choices .list-choices _main_complete
        }
        afu-zle-force-install
        {
            "$@"
        }
    } always {
        eval "function afu-zle-rebind-restore () { ${(j.;.)restores} }"
        afu-zle-rebind-restore
        $0 () {
            {
                afu-zle-force-install
                {
                    "$@"
                }
            } always {
                afu-zle-rebind-restore
            }
        }
    }
}
Firef0x commented 9 years ago

Does same error still happen if your ~/.zshrc like this instead? (This means don't use zcompiled file.)

Error message still shows, but not the same. Here is the output:

afu-rh-clear-maybe:3: maximum nested function level reached
$ cd ( Then I type 'cd', and the same error message shows again immediately)
afu-rh-clear-maybe:3: maximum nested function level reached

Seems like thing's gonna be worse~~~

Could you post some portions of ~/.zsh/auto-fu ?

Here is the whole file: https://gist.github.com/Firef0x/88c833e7590860fd53a7#file-auto-fu

I want to see with-afu-zle-rebinding function in it. It should be something like this:

I've compared the part you mentioned, and found only one difference. It' s in https://gist.github.com/Firef0x/88c833e7590860fd53a7#file-auto-fu-L681 , which is afu-zle-aysce-install compared to afu-zle-force-install . That's all I can see.

Then I replace afu-zle-aysce-install with afu-zle-force-install, no error message is showing up this time. ─=≡Σ((( つ•̀ω•́)つ

Firef0x commented 9 years ago

So it means that I have to replace afu-zle-aysce-install with afu-zle-force-install every time after I zcompiled auto-fu.zsh into ~/.zsh :question: :grey_question: :question:

Or this is really a bug in this project :u6709: :bug: :question: :grey_question:

Hope for your reply !

Yours sincerely

hchbaw commented 9 years ago

I'm very sorry, it's too late.

Thank you very much for posting on https://gist.github.com/Firef0x/88c833e7590860fd53a7#file-auto-fu.

Yes. I have wanted to see this line: https://gist.github.com/Firef0x/88c833e7590860fd53a7#file-auto-fu-L681

But I cannot figure out how this line came from… Then, I would like to see your local auto-fu.zsh checkout, https://github.com/hchbaw/auto-fu.zsh/blob/42dbef5da89360f132cce010004d4c674a13c951/auto-fu.zsh#L1461 I suspect that above line may have afu-zle-aysce-install somehow.

Firef0x commented 9 years ago

https://github.com/hchbaw/auto-fu.zsh/blob/42dbef5da89360f132cce010004d4c674a13c951/auto-fu.zsh#L1461 I suspect that above line may have afu-zle-aysce-install somehow.

I just did a clean clone to my computer, and the file auto-fu.zsh is the same as the one in https://github.com/hchbaw/auto-fu.zsh/blob/42dbef5da89360f132cce010004d4c674a13c951/auto-fu.zsh , and line 1461 is afu-zle-force-install of course.

What's more, there is no output of the command git status --short in my local clone repo. :confused:

Hope for your reply !

Yours sincerely

hchbaw commented 9 years ago

Thank you very much for your clarifications. I cannot find out why this aysce thing is coming.

These are quite trial and errors: How does below snippet output, does it still output aysce?

A=/path/to/auto-fu.zsh; zsh -c "source $A; functions with-afu-zle-rebinding"

It may or may not be a configration problem, I want to see your setopts at auto-fu-zcompileing:

 zsh -c 'zmodload zsh/parameter; for k v in ${(kv)options}; do echo $k $v; done'

What's happening in general when creating ~/.zsh/auto-fu, I want to see the trace informations in /tmp/z.log by below command:

A=/path/to/auto-fu.zsh
(zsh -c "setopt xtrace; source $A ; auto-fu-zcompile ~/.zsh/")  > /tmp/z.log 2>&1

Sorry, these will take lots of your time.

Firef0x commented 9 years ago

How does below snippet output, does it still output aysce? A=/path/to/auto-fu.zsh; zsh -c "source $A; functions with-afu-zle-rebinding"

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-output1 No aysce found in the output.

I want to see your setopts at auto-fu-zcompileing: zsh -c 'zmodload zsh/parameter; for k v in ${(kv)options}; do echo $k $v; done'

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-output2

I want to see the trace informations in /tmp/z.log by below command: A=/path/to/auto-fu.zsh (zsh -c "setopt xtrace; source $A ; auto-fu-zcompile ~/.zsh/") > /tmp/z.log 2>&1

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-z-log

Hope for your reply !

Yours sincerely

hchbaw commented 9 years ago

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-output1 No aysce found in the output.

Thanks, I'm glad to hear this. This is very OK.

I want to see your setopts at auto-fu-zcompileing:

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-output2

This is exactly the same as mine. Thank you very much.

I want to see the trace informations in /tmp/z.log by below command:

See https://gist.github.com/Firef0x/a09d323e816005603ed6#file-z-log

After fiddling around with some paths informations in my trace output file, % diff -u z.log′ a09d323e816005603ed6/z.log just outputs:

--- "z.log\342\200\262" 2014-10-08 20:44:03.432413089 +0900
+++ a09d323e816005603ed6/z.log  2014-10-08 20:39:24.472742730 +0900
@@ -620,7 +620,7 @@
           zle -C list-choices .list-choices _main_complete

         }
-        afu-zle-force-install
+        afu-zle-aysce-install
         { "$@" }
       } always {
         eval "function afu-zle-rebind-restore () { ${(j.;.)restores} }"

Ugh… Sorry, I have no idea… I will fresh install this OS and see what will happen.

Sorry for the inconvenience, for now, please do below commands to zcomplie:

A=/path/to/auto-fu.zsh; (zsh -c "source $A ; auto-fu-zcompile $A ~/.zsh/ =(echo 'afu-zle-aysce-install () afu-zle-force-install;')")

Or please add below snippets in your '~/.zshrc':

afu-zle-aysce-install () afu-zle-force-install;

Thank you very much for your reports and taking lots of your time.

Firef0x commented 9 years ago

Okey-dokey! I get it! I'll keep this issue open.

どうもありがとうございます !

Yours sincerely