zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Karel Balej <karelb@gimli.ms.mff.cuni.cz>
Cc: zsh-users@zsh.org
Subject: Re: todoman completion
Date: Sun, 28 Aug 2022 10:56:17 +0000	[thread overview]
Message-ID: <20220828105617.GA5920@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20220828064342.25a2cdzg5sdxm4x4@imladris>

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.


  reply	other threads:[~2022-08-28 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-28  6:43 Karel Balej
2022-08-28 10:56 ` Daniel Shahaf [this message]
2022-08-28 15:34   ` Karel Balej

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220828105617.GA5920@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=karelb@gimli.ms.mff.cuni.cz \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).