zsh-users
 help / color / mirror / code / Atom feed
From: Karel Balej <karelb@gimli.ms.mff.cuni.cz>
To: zsh-users@zsh.org
Subject: todoman completion
Date: Sun, 28 Aug 2022 08:43:42 +0200	[thread overview]
Message-ID: <20220828064342.25a2cdzg5sdxm4x4@imladris> (raw)

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

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?

I attach a patch of other changes I have had to make for the completion
to work.

[1] https://github.com/pimutils/todoman/blob/main/contrib/completion/zsh/_todo
[2] https://github.com/pimutils/todoman

Thank you,
K.

[-- Attachment #2: todoman.patch --]
[-- Type: text/x-diff, Size: 1152 bytes --]

diff --git a/contrib/completion/zsh/_todo b/contrib/completion/zsh/_todo
index b9bbe8a..8951906 100644
--- a/contrib/completion/zsh/_todo
+++ b/contrib/completion/zsh/_todo
@@ -32,7 +32,7 @@ __color_mode(){
 # }}}
 # {{{ general helper: set variable of path to configuration file
 __todo_set_conf(){
-	todoman_configuration_file=${XDG_CONFIG_DIR:-${HOME}/.config}/todoman/todoman.conf
+	todoman_configuration_file=${XDG_CONFIG_DIR:-${HOME}/.config}/todoman/config.py
 	if [[ -f $todoman_configuration_file ]]; then
 		return 0
 	else
@@ -43,7 +43,7 @@ __todo_set_conf(){
 # {{{ general helper: set variable main.path from configuration file
 __todo_set_conf_path(){
 	if __todo_set_conf; then
-		tasks_lists_path="$(sed -n -e 's/^[^#]\s*path\s*=\s*\(.*\)$/\1/p' $todoman_configuration_file 2>/dev/null)"
+		tasks_lists_path="$(sed -n -e "s/^\\s*path\\s*=\\s*['\"]\\(.*\\)['\"]$/\\1/p" $todoman_configuration_file 2>/dev/null)"
 		# the eval echo is needed since the path may contain ~ which should be evalueated to $HOME
 		tasks_lists_dir="$(eval echo ${tasks_lists_path%/\**})"
 		if [[ -z "${tasks_lists_path}" || ! -d "${tasks_lists_dir}" ]]; then

             reply	other threads:[~2022-08-28  6:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-28  6:43 Karel Balej [this message]
2022-08-28 10:56 ` Daniel Shahaf
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=20220828064342.25a2cdzg5sdxm4x4@imladris \
    --to=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).