zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] _add-zle-hook-widget: New completion.
Date: Mon, 18 Jul 2016 11:47:57 +0200	[thread overview]
Message-ID: <91351.1468835277@hydra.kiddle.eu> (raw)
In-Reply-To: <1468767614-9635-1-git-send-email-danielsh@tarsus.local2>

Daniel Shahaf wrote:
> +local context state state_descr line
> +typeset -A opt_args

Those are only needed if you're using _values or _arguments with states.
This function doesn't so that isn't needed.

> +    _wanted widgets expl "installed hooks" compadd -- ${tmp#<->:} && return 0

The description should be singular - "installed hook". Even if you can
specify a list, they are only completed one at a time.

> +  else
> +    _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets && ret=0 && return 0
> +  fi
> +  return 1

ret was not declared local so ret=0 should not be there.
Actually, all this messing with return codes is superfluous. Given an
if..then..else block, the last command in either branch determines the
final return status. If you have '&& return 0', the 0 is always
redundant. But in this case, no return statement at all should be needed.

Also, Bart suggested:
>  compadd "$@" -M 'L:|zle-=' -a hooktypes

That L: form makes the zle- a sort of optional prefix. Is that what
you intended? Unfortunately it doesn't work together with -M 'r:|-=*
r:|=*' and zl<tab> won't complete. 'B:zle-=' is a shorter version
of the same thing. It might be better to do:
  compadd "$@" -a hooktypes || compadd "$@" -pzle- -a hooktypes

Oliver


  parent reply	other threads:[~2016-07-18  9:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 10:40 Next release (5.3) Peter Stephenson
2016-07-04 15:04 ` Bart Schaefer
2016-07-05  6:00   ` Sebastian Gniazdowski
2016-07-05  6:33     ` Bart Schaefer
2016-07-05  8:33   ` Peter Stephenson
2016-07-05 11:48     ` Peter Stephenson
2016-07-05 16:29       ` Bart Schaefer
2016-07-07  2:00   ` Daniel Shahaf
2016-07-13  5:00     ` add-zle-hook-widget " Daniel Shahaf
2016-07-14  0:11       ` Bart Schaefer
2016-07-17  1:51         ` Bart Schaefer
2016-07-17 15:00           ` [PATCH] _add-zle-hook-widget: New completion Daniel Shahaf
2016-07-17 19:21             ` Bart Schaefer
2016-07-17 20:40               ` Bart Schaefer
2016-07-17 21:57             ` Bart Schaefer
2016-07-18  9:47             ` Oliver Kiddle [this message]
2016-07-18 15:30               ` Bart Schaefer
2016-07-19 10:30                 ` Oliver Kiddle
2016-07-19 17:58                   ` Bart Schaefer
2016-07-20  6:54               ` [PATCH v2] " Daniel Shahaf
2016-07-21 15:28                 ` Oliver Kiddle
2016-07-22  6:22                   ` Daniel Shahaf
2016-07-22 18:21                     ` Bart Schaefer
2016-07-22 18:45                     ` Oliver Kiddle
2016-07-23 18:03                       ` Daniel Shahaf
2016-07-17 14:59         ` add-zle-hook-widget Re: Next release (5.3) Daniel Shahaf
2016-07-17 18:48           ` Bart Schaefer

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=91351.1468835277@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@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).