Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: todoman completion



Karel Balej wrote on Sun, Aug 28, 2022 at 08:43:42 +0200:
> Hello,
> 
> I'm trying to get the bundled zsh completion function [1] for todoman
> [2] to work on my system but I don't seem to be able to do so.
> 
> Specifically, I'm currently attempting to make `todo list<Tab>` complete
> the available lists. The problem I am stuck at seems to be that the cache
> policy function `__todo_lists_cache_policy` at line 127 is never called
> and I cannot figure out why: the cache policy setting at lines 147-151
> seems correct and yet the call to `_cache_invalid` at line 153 does not
> redirect to `__todo_lists_cache_policy` at all. If I place the function
> name there directly, everything works as expected.
> 
> Could you please point me to the cause of this issue?
> 

Observations:

1. _cache_invalid won't call the policy function at all if use-cache
isn't set.

2. The use of _cache_* functions isn't idiomatic (compare the callsites
of those functions in zsh.git:Completion/**/_*).

Hypothesis:

In your case the use-cache style is unset or set to false (check `zstyle
-L | grep use-cache`).  That causes _cache_invalid to return false
without calling the policy function, then todoman's completion calls
_retrieve_cache and doesn't notice that it returns non-zero.

Thus:

Workaround: Set the use-cache style to a true value.

Fix: Call _retrieve_cache idiomatically.




Messages sorted by: Reverse Date, Date, Thread, Author