beets: zsh completion cache is broken

Problem

The zsh completion is broken. After zsh loads the cached functions you give the following error when try to complete (beet <tab>).

_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
_beet:4: command not found: _ra_comp
(repeat several times)

My zshrc file is very simple.

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ogarcia/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

The problem is introduced in this commit: https://github.com/beetbox/beets/commit/5282d2882eb9cd4cb7e9d9370256c599575bcaee

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 1
  • Comments: 43 (3 by maintainers)

Commits related to this issue

Most upvoted comments

The problem is that there is no function to add to a cache file; you can only (re)create the whole thing in one go, which means that if you want to do incremental caching it makes more sense to have separate cache files. If someone could write an _append_cache function (e.g. by making some adjustments to _store_cache) that would be really useful… fancy trying it? Another problem with my solution is that it pollutes the environment with lots of variables (with names starting beets_). Unfortunately this is unavoidable when using zsh completion caches since the variables are made global when retrieved from the cache.

OK, I’ve now fixed _beet to use the proper zsh caching functions _store_cache, _retrieve_cache and _cach_invalid: https://github.com/beetbox/beets/commit/209d281871e7d86bf60729f2ca25e60b0aaa0e2b Let me know if you still have problems.

Yeap, switching to the previous did the trick.

Thanks @ogarcia

@Jucgshu the best way is simply remove the completion file:

sudo rm /usr/share/zsh/site-functions/_beet

Other option is use an old version before cache “patch”.

cd /tmp
wget 'https://raw.githubusercontent.com/beetbox/beets/9dc79950d3d9ebdfe09224e27e3af258f7438ae6/extra/_beet'
sudo cp _beet /usr/share/zsh/site-functions/_beet
rm _beet

@vapniks any news about this?