zsh-workers
 help / color / mirror / code / Atom feed
* Zstyle command completion does not work for some executables
@ 2016-01-28 14:52 Silvio Ricardo Cordeiro
  2016-01-28 14:54 ` Silvio Ricardo Cordeiro
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Silvio Ricardo Cordeiro @ 2016-01-28 14:52 UTC (permalink / raw)
  To: zsh-workers

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

On an otherwise empty .zshrc:

Some completion specifications work normally:

> zstyle ':completion:*:*killall*:*' command 'echo testing'
> zstyle ':completion:*:*rake*:*' command 'echo testing'
>

While other completion just do *not* work:

> zstyle ':completion:*:*bash*:*' command 'echo testing'
> zstyle ':completion:*:*some_file_in_PATH*:*' command 'echo testing'

zstyle ':completion:*:*inexistent_executable*:*' command 'echo testing'
>

Is there any way to debug this kind of behavior?  I have tried pressing
"^X?", but the output is the same for "killall" and for "bash"...

-- 
Silvio Ricardo Cordeiro

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

* Re: Zstyle command completion does not work for some executables
  2016-01-28 14:52 Zstyle command completion does not work for some executables Silvio Ricardo Cordeiro
@ 2016-01-28 14:54 ` Silvio Ricardo Cordeiro
  2016-01-29  9:19 ` Daniel Shahaf
  2016-01-29 17:52 ` Bart Schaefer
  2 siblings, 0 replies; 7+ messages in thread
From: Silvio Ricardo Cordeiro @ 2016-01-28 14:54 UTC (permalink / raw)
  To: zsh-workers

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

Oops, pressed Send too early.

$ zsh --version
zsh 5.0.5 (x86_64-pc-linux-gnu)

Thanks for your help,

2016-01-28 12:52 GMT-02:00 Silvio Ricardo Cordeiro <silvioricardoc@gmail.com
>:

> On an otherwise empty .zshrc:
>
> Some completion specifications work normally:
>
>> zstyle ':completion:*:*killall*:*' command 'echo testing'
>> zstyle ':completion:*:*rake*:*' command 'echo testing'
>>
>
> While other completion just do *not* work:
>
>> zstyle ':completion:*:*bash*:*' command 'echo testing'
>> zstyle ':completion:*:*some_file_in_PATH*:*' command 'echo testing'
>
> zstyle ':completion:*:*inexistent_executable*:*' command 'echo testing'
>>
>
> Is there any way to debug this kind of behavior?  I have tried pressing
> "^X?", but the output is the same for "killall" and for "bash"...
>
> --
> Silvio Ricardo Cordeiro
>



-- 
Silvio Ricardo Cordeiro

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

* Re: Zstyle command completion does not work for some executables
  2016-01-28 14:52 Zstyle command completion does not work for some executables Silvio Ricardo Cordeiro
  2016-01-28 14:54 ` Silvio Ricardo Cordeiro
@ 2016-01-29  9:19 ` Daniel Shahaf
  2016-01-29 12:35   ` Silvio Ricardo Cordeiro
  2016-01-29 17:52 ` Bart Schaefer
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel Shahaf @ 2016-01-29  9:19 UTC (permalink / raw)
  To: Silvio Ricardo Cordeiro; +Cc: zsh-workers

Silvio Ricardo Cordeiro wrote on Thu, Jan 28, 2016 at 12:52:44 -0200:
> On an otherwise empty .zshrc:
> 
> Some completion specifications work normally:
> 
> > zstyle ':completion:*:*killall*:*' command 'echo testing'
> > zstyle ':completion:*:*rake*:*' command 'echo testing'

What is happening?  What do you want to happen?

The 'command' style isn't used by all completion functions.

Cheers,

Daniel

> While other completion just do *not* work:
> 
> > zstyle ':completion:*:*bash*:*' command 'echo testing'
> > zstyle ':completion:*:*some_file_in_PATH*:*' command 'echo testing'
> 
> zstyle ':completion:*:*inexistent_executable*:*' command 'echo testing'
> >
> 
> Is there any way to debug this kind of behavior?  I have tried pressing
> "^X?", but the output is the same for "killall" and for "bash"...
> 
> -- 
> Silvio Ricardo Cordeiro


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

* Re: Zstyle command completion does not work for some executables
  2016-01-29  9:19 ` Daniel Shahaf
@ 2016-01-29 12:35   ` Silvio Ricardo Cordeiro
  2016-01-29 13:01     ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Silvio Ricardo Cordeiro @ 2016-01-29 12:35 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers

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

For killall & rake, I get "testing" as a suggestion, as I expected.  For
the others, nothing happens (they continue trying to complete with
filenames, the default behavior).

Do I have to somehow specify that "this command must obey the command
style" for my custom commands?

Thanks,

2016-01-29 7:19 GMT-02:00 Daniel Shahaf <d.s@daniel.shahaf.name>:

> Silvio Ricardo Cordeiro wrote on Thu, Jan 28, 2016 at 12:52:44 -0200:
> > On an otherwise empty .zshrc:
> >
> > Some completion specifications work normally:
> >
> > > zstyle ':completion:*:*killall*:*' command 'echo testing'
> > > zstyle ':completion:*:*rake*:*' command 'echo testing'
>
> What is happening?  What do you want to happen?
>
> The 'command' style isn't used by all completion functions.
>
> Cheers,
>
> Daniel
>
> > While other completion just do *not* work:
> >
> > > zstyle ':completion:*:*bash*:*' command 'echo testing'
> > > zstyle ':completion:*:*some_file_in_PATH*:*' command 'echo testing'
> >
> > zstyle ':completion:*:*inexistent_executable*:*' command 'echo testing'
> > >
> >
> > Is there any way to debug this kind of behavior?  I have tried pressing
> > "^X?", but the output is the same for "killall" and for "bash"...
> >
> > --
> > Silvio Ricardo Cordeiro
>



-- 
Silvio Ricardo Cordeiro

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

* Re: Zstyle command completion does not work for some executables
  2016-01-29 12:35   ` Silvio Ricardo Cordeiro
@ 2016-01-29 13:01     ` Peter Stephenson
  2016-01-29 13:19       ` Silvio Ricardo Cordeiro
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2016-01-29 13:01 UTC (permalink / raw)
  To: Silvio Ricardo Cordeiro, zsh-workers

On Fri, 29 Jan 2016 10:35:43 -0200
Silvio Ricardo Cordeiro <silvioricardoc@gmail.com> wrote:
> For killall & rake, I get "testing" as a suggestion, as I expected.  For
> the others, nothing happens (they continue trying to complete with
> filenames, the default behavior).

You're missing the point of the "command" style.  Read the docmentation
in Standard Styles in zshcompsys in more detail.  As a summary:

For some commands, as part of the way the completion system gathers
information to complete, it needs to run the command named.  In the case
of killall and rake, it does so to find out what processes killall knows
about or what targets rake knows about.  So if you tell it to run a
different command here it will do so.

For the vast majority of completion contexts, it doesn't need to do
this.  It makes up the completion based on what it's been told the
context is.  It doesn't run an external command for this.

I think what you're trying to do is add completion for a new context (a
specific command) or modify an existing one.  The "command" style has
got nothing at all to do with this.  Instead, you need to start much
deeper in the documentation and learn about how to add new completions
or modify exsting ones.

Oliver's chapters in the book, www.bash2zsh.com, are a good starting
point.

Otherwise, have a glance through

http://zsh.sourceforge.net/Guide/zshguide06.html#l144

and in particular section 6.9.

pws


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

* Re: Zstyle command completion does not work for some executables
  2016-01-29 13:01     ` Peter Stephenson
@ 2016-01-29 13:19       ` Silvio Ricardo Cordeiro
  0 siblings, 0 replies; 7+ messages in thread
From: Silvio Ricardo Cordeiro @ 2016-01-29 13:19 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

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

OK, thank you for the pointers.

Cheers,

2016-01-29 11:01 GMT-02:00 Peter Stephenson <p.stephenson@samsung.com>:

> On Fri, 29 Jan 2016 10:35:43 -0200
> Silvio Ricardo Cordeiro <silvioricardoc@gmail.com> wrote:
> > For killall & rake, I get "testing" as a suggestion, as I expected.  For
> > the others, nothing happens (they continue trying to complete with
> > filenames, the default behavior).
>
> You're missing the point of the "command" style.  Read the docmentation
> in Standard Styles in zshcompsys in more detail.  As a summary:
>
> For some commands, as part of the way the completion system gathers
> information to complete, it needs to run the command named.  In the case
> of killall and rake, it does so to find out what processes killall knows
> about or what targets rake knows about.  So if you tell it to run a
> different command here it will do so.
>
> For the vast majority of completion contexts, it doesn't need to do
> this.  It makes up the completion based on what it's been told the
> context is.  It doesn't run an external command for this.
>
> I think what you're trying to do is add completion for a new context (a
> specific command) or modify an existing one.  The "command" style has
> got nothing at all to do with this.  Instead, you need to start much
> deeper in the documentation and learn about how to add new completions
> or modify exsting ones.
>
> Oliver's chapters in the book, www.bash2zsh.com, are a good starting
> point.
>
> Otherwise, have a glance through
>
> http://zsh.sourceforge.net/Guide/zshguide06.html#l144
>
> and in particular section 6.9.
>
> pws
>



-- 
Silvio Ricardo Cordeiro

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

* Re: Zstyle command completion does not work for some executables
  2016-01-28 14:52 Zstyle command completion does not work for some executables Silvio Ricardo Cordeiro
  2016-01-28 14:54 ` Silvio Ricardo Cordeiro
  2016-01-29  9:19 ` Daniel Shahaf
@ 2016-01-29 17:52 ` Bart Schaefer
  2 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2016-01-29 17:52 UTC (permalink / raw)
  To: zsh-workers

[I wrote all this and then it never went out.  Sending it anyway because
it adds a little bit to PWS's response.]

On Jan 28, 12:52pm, Silvio Ricardo Cordeiro wrote:
} Subject: Zstyle command completion does not work for some executables

The "command" style is implemented by the _call_program helper function.
Consequently it only works for completions that use _call_program.

Doc says:

     In many places, completion functions need to call external
     commands to generate the list of completions.  This style can be
     used to override the command that is called in some such cases.

In your examples e.g.

} > zstyle ':completion:*:*bash*:*' command 'echo testing'

The writer of the _sh completion did not feel any external command
was needed in order to generate the list of completions, so no use
of _call_program was made and the command style does not apply.  For
an arbitrary command in your path, there probably isn't a specific
completion function at all, so there can't be a _call_program.

[Rest trimmed as it duplicated what PWS already said.]


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

end of thread, other threads:[~2016-01-29 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 14:52 Zstyle command completion does not work for some executables Silvio Ricardo Cordeiro
2016-01-28 14:54 ` Silvio Ricardo Cordeiro
2016-01-29  9:19 ` Daniel Shahaf
2016-01-29 12:35   ` Silvio Ricardo Cordeiro
2016-01-29 13:01     ` Peter Stephenson
2016-01-29 13:19       ` Silvio Ricardo Cordeiro
2016-01-29 17:52 ` Bart Schaefer

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