zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _widgets: Complete zle-* widgets too.
@ 2016-07-30 13:11 Daniel Shahaf
  2016-07-30 14:40 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2016-07-30 13:11 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Zsh/Type/_widgets | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Completion/Zsh/Type/_widgets b/Completion/Zsh/Type/_widgets
index fdab281..0e7f491 100644
--- a/Completion/Zsh/Type/_widgets
+++ b/Completion/Zsh/Type/_widgets
@@ -2,8 +2,14 @@
 
 local expl pattern
 
+local -a fake
+autoload -U add-zle-hook-widget
+add-zle-hook-widget -h >&/dev/null # sets the zstyle
+zstyle -g fake zle-hook types
+fake=( zle-${^fake} )
+
 pattern=( -g \* )
 zparseopts -D -K -E g:=pattern
 
 _description widgets expl widget
-compadd "$@" "$expl[@]" -M 'r:|-=* r:|=*' - "${(@k)widgets[(R)${pattern[2]}]}"
+compadd "$@" "$expl[@]" -M 'r:|-=* r:|=*' - "${(@k)widgets[(R)${pattern[2]}]}" "${(@M)fake:#${~pattern[2]}}"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] _widgets: Complete zle-* widgets too.
  2016-07-30 13:11 [PATCH] _widgets: Complete zle-* widgets too Daniel Shahaf
@ 2016-07-30 14:40 ` Bart Schaefer
  2016-07-31 16:18   ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2016-07-30 14:40 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

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

I don't think this is right.  Those names should be completed only if they
have already been created with "zle -N", and it is not appropriate to
autoload add-zle-hook-widget in the generic widgets completion function.

On Jul 30, 2016 8:13 AM, "Daniel Shahaf" <d.s@daniel.shahaf.name> wrote:

> ---
>  Completion/Zsh/Type/_widgets | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/Completion/Zsh/Type/_widgets b/Completion/Zsh/Type/_widgets
> index fdab281..0e7f491 100644
> --- a/Completion/Zsh/Type/_widgets
> +++ b/Completion/Zsh/Type/_widgets
> @@ -2,8 +2,14 @@
>
>  local expl pattern
>
> +local -a fake
> +autoload -U add-zle-hook-widget
> +add-zle-hook-widget -h >&/dev/null # sets the zstyle
> +zstyle -g fake zle-hook types
> +fake=( zle-${^fake} )
> +
>  pattern=( -g \* )
>  zparseopts -D -K -E g:=pattern
>
>  _description widgets expl widget
> -compadd "$@" "$expl[@]" -M 'r:|-=* r:|=*' -
> "${(@k)widgets[(R)${pattern[2]}]}"
> +compadd "$@" "$expl[@]" -M 'r:|-=* r:|=*' -
> "${(@k)widgets[(R)${pattern[2]}]}" "${(@M)fake:#${~pattern[2]}}"
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] _widgets: Complete zle-* widgets too.
  2016-07-30 14:40 ` Bart Schaefer
@ 2016-07-31 16:18   ` Daniel Shahaf
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-07-31 16:18 UTC (permalink / raw)
  To: Zsh hackers list

Bart Schaefer wrote on Sat, Jul 30, 2016 at 07:40:08 -0700:
> I don't think this is right.  Those names should be completed only if they
> have already been created with "zle -N",

In second thought, I agree.  Consider this patch scrapped.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-31 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30 13:11 [PATCH] _widgets: Complete zle-* widgets too Daniel Shahaf
2016-07-30 14:40 ` Bart Schaefer
2016-07-31 16:18   ` Daniel Shahaf

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).