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

Already on GitHub? Sign in to your account

fixed & speedups #37

Closed
wants to merge 3 commits into
from

Conversation

3 participants
Contributor

wrboyce commented Jan 10, 2013

  • blank lines were being passed to antigen-bundle by antigen-bundles
  • fixed startup/compdef issues discussed in #36

@neersighted neersighted referenced this pull request Jan 10, 2013

Closed

Simplify loading logic #39

Contributor

wrboyce commented Mar 12, 2013

Any issue with merging this? I've been using it for a while without issue now…

Member

sharat87 commented Mar 13, 2013

I'm sure I made a comment on this pull request, can't seem to find it now.

Anyway, blank lines are already being ignored by the grep command before the while loop, so they should already be ignored. Is it not working for you?

As for the compdef changes, I actually merged those two commits (cherry picked) but didn't push as I wanted to test for a few days (its been a week I think). I'll push them now.

Member

sharat87 commented Mar 13, 2013

Okay, the implementation is... incomplete. You don't see any issues because compdef calls are not being deferred at all. I think I addressed this now. Please pull and test.

Thanks.

sharat87 added a commit that referenced this pull request Mar 13, 2013

Don't load compinit module at startup.
Kills the whole purpose of the compdef deferrer function introduced in #37.
Completions are now correctly deferred and applied when `antigen-apply` is
called.
Contributor

wrboyce commented Mar 13, 2013

What is the reason for running the compdef calls inside eval?

Regarding the ${line} issue, perhaps this helps:

anarki:~% /usr/bin/grep -v '^\s*$\|^#' ~/.zshrc

export ZSH=$HOME/.zsh
source $ZSH/main.zsh

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
anarki:~% /usr/bin/grep --version
grep (BSD grep) 2.5.1-FreeBSD

Blank lines! I don't see the harm in the [ ! -z ${line} ] check…

EDIT: Can you elaborate on compdef calls not being deferred? I've added set -x to the top of my zshrc and the compinit/compdef calls are definitely the last thing executed before my shell is ready.

Member

sharat87 commented Mar 13, 2013

What is the reason for running the compdef calls inside eval?

Good question. I'm not really sure. I spent a good 3 hours trying to figure it out. Without the eval, if I run compdef right inside the loop, the completions for git aliases give out an error (defined in ohmyzsh git plugin). Although the completions for those aliases works fine, there is no such error when I use eval there. If you or someone else can figure it out, please open a new issue/send a new pull req.

The compinit module is loaded in the -antigen-env-setup, which replaces the compdef function. Try putting a debug echo line in the compdef function, you shouldn't see that message.

As for the blank line check, yes the grep is not working as it should. Adding another check is not the solution. Even more so because the grep is not filtering comments too. I'll fix it now. Thanks for bringing it up.

Contributor

wrboyce commented Mar 13, 2013

Weird… I updated the compdef function definition:

typeset -a __deferred_compdefs
compdef () {
    echo "deferring compdef call \"${*}\""
    __deferred_compdefs=($__deferred_compdefs "$*")
}

And opened a new shell:

Last login: Wed Mar 13 16:14:45 on ttys008
deferring compdef call "_antigen antigen"
deferring compdef call "g=git"
deferring compdef call "_managepy manage.py"
deferring compdef call "_managepy django"
deferring compdef call "_managepy django-manage"
deferring compdef call "_npm_completion npm"
anarki:~%

And completion is definitely working:

anarki:~% g [tab]
add                      ci                       diff                     init                     rebase                   show-merges
alias                    citool                   diffstat                 instaweb                 refactor                 squash
aliases                  cl                       difftool                 lc                       reflog                   st
am                       clean                    effort                   lg                       release                  stage
amend                    clone                    extras                   licence                  relink                   stash
annotate                 cm                       feature                  local-commits            remote                   status
apply                    co                       fetch                    log                      rename-tag               suba
archive                  column                   filter-branch            merge                    repack                   submodule
back                     commit                   flow                     mergetool                repl                     subtree
bisect                   commits-since            format-patch             mv                       replace                  summary
blame                    config                   fresh-branch             name-rev                 request-pull             svn
br                       contrib                  fsck                     notes                    reset                    tag
branch                   count                    gc                       p4                       revert                   touch
bug                      cp                       get-tar-commit-id        pat                      review                   undo
bundle                   create-branch            gh-pages                 pod                      ribbon                   whatchanged
catchup                  credential               graft                    pom                      rm                       wt-add
changelog                credential-osxkeychain   grep                     prune-all                send-email               wtf
changes                  delete-branch            gui                      publish-branch           setup
checkout                 delete-submodule         help                     pull                     shortlog
cherry                   delete-tag               ignore                   push                     show
cherry-pick              describe                 imap-send                rank-contributors        show-branch    

Out of curiosity… What version of zsh are you using?

anarki:~% zsh --version
zsh 5.0.2 (x86_64-apple-darwin12.2.1)

And should they make a difference:

anarki:~% setopt
alwaystoend
autocd
autonamedirs
autopushd
cdablevars
completeinword
correctall
extendedglob
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histverify
incappendhistory
interactive
kshglob
login
longlistjobs
monitor
promptsubst
pushdignoredups
sharehistory
shinstdin
zle
Contributor

wrboyce commented Mar 13, 2013

The compinit module is loaded in the -antigen-env-setup, which replaces the compdef function. Try putting a debug echo line in the compdef function, you shouldn't see that message.

But why? You don't need to call compinit until antigen-apply, which will then cause compdef to be redefined as the proper function.

Member

sharat87 commented Mar 13, 2013

But why? You don't need to call compinit until antigen-apply, which will then cause compdef to be redefined as the proper function.

Precisely. That's why I removed that line from -antigen-env-setup and put it in antigen-apply.

My zsh version is 4.3.17. I'm being lazy to upgrade my zsh, but we can't break compatibility with 4.x either, can we? Either way, I'm not even sure if its the zsh version causing all the trouble.

You have extendedglob, kshglob and login in your setopt that I don't. Everything else is same. Not sure what that means. I'll try debugging and removing the eval some time again later, unless someone better at taming zsh does it before me :). Just so we know its not a zsh bug that's been fixed or something, could you try removing the eval and run compdef right inside the for loop, should it work in zsh5?

Member

sharat87 commented Mar 13, 2013

Blank lines thing should be fixed now.

Contributor

wrboyce commented Mar 13, 2013

Just so we know its not a zsh bug that's been fixed or something, could you try removing the eval and run compdef right inside the for loop, should it work in zsh5?

Sorry should have been clearer… that is how I have my antigen.zsh currently. No eval.

I think you're right, we need to maintain compatibility with zsh 4, if it is a versioning issue.

Member

sharat87 commented Mar 14, 2013

So, I suppose I'll let the eval be until we figure out what's going wrong. I'll get zsh5 one of these days and test on that too.

So what's up here?

Member

sharat87 commented May 12, 2015

This is obviously not happening and antigen's changed quite a bit since this issue has come up. If work is indeed being done on this topic, please open small individual PRs with focused improvements instead of an large ambitious one that is unlikely to be completed.

Thank you for all the effort though :)

@sharat87 sharat87 closed this May 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment