zsh-users
 help / color / mirror / code / Atom feed
* completion issue
@ 2014-06-08 17:40 Vadim A. Misbakh-Soloviov
  2014-06-08 19:27 ` Bart Schaefer
  2014-06-11  9:06 ` Vadim A. Misbakh-Soloviov
  0 siblings, 2 replies; 7+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2014-06-08 17:40 UTC (permalink / raw)
  To: Zsh Users List

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

Hi there!

I experienced some issue, related to completion. Here is some summarizing of my debug-digging:

When I have any (or both, like in my usual .zshrc) line of:
> zstyle ':completion:::::' completer _expand _force_rehash _complete _ignored _gnu_generic _approximate
or:
> zstyle ':completion:*' completer _complete _ignored _gnu_generic _approximate _oldlist _force_rehash

and trying to call completion of, for example, non-existant path on FS, I get error:
> _arguments:comparguments:312: invalid option definition: -V[N]fname[Be verbose (level N) (log messages to fname)]

When I have also:
> zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=**' 'm:{a-z}={A-Z} m:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=** l:|=*' 'm:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=** l:|=*' 'm:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=** l:|=*'
in my .zshrc then quoted error duplicates 4 times in a row.

Is it any way to fix it, but keep effects of that configuration?


Thanks!

-- 
Best regsrds,
mva

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: completion issue
  2014-06-08 17:40 completion issue Vadim A. Misbakh-Soloviov
@ 2014-06-08 19:27 ` Bart Schaefer
  2014-06-08 19:51   ` Vadim A. Misbakh-Soloviov
  2014-06-11  9:06 ` Vadim A. Misbakh-Soloviov
  1 sibling, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2014-06-08 19:27 UTC (permalink / raw)
  To: Vadim A. Misbakh-Soloviov, Zsh Users List

On Jun 9, 12:40am, Vadim A. Misbakh-Soloviov wrote:
}
} 
} I experienced some issue, related to completion. Here is some summarizing of my debug-digging:
} 
} > _arguments:comparguments:312: invalid option definition: -V[N]fname[Be verbose (level N) (log messages to fname)]

This is a help message from "vim".  Since the default _vim completion
function does not attempt to parse the output of "vim --help", this
must be coming from some other completion function that you have in your
$fpath.  You will need to contact whoever wrote that function and get
them to fix it.

If you're seeing the above error when completing after a command other
than "vim" (or an alias for vim), then something else is messed up.

The output of this might be helpful:

    which-completion() {
	emulate -R zsh
	print -l ${(u~):-${^fpath}/${(v)^_comps[(I)(|*,)$1(,*|)]}(N-.)}
    }

Run that as e.g.

    which-completion vim

to see which function is being called for completion of the "vim" command.


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

* Re: completion issue
  2014-06-08 19:27 ` Bart Schaefer
@ 2014-06-08 19:51   ` Vadim A. Misbakh-Soloviov
  2014-06-08 20:11     ` Frank Terbeck
  2014-06-08 21:04     ` Bart Schaefer
  0 siblings, 2 replies; 7+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2014-06-08 19:51 UTC (permalink / raw)
  To: zsh-users

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

Hi, Bart! Thanks for reply!

В письме от Вс, 8 июня 2014 12:27:33 пользователь Bart Schaefer написал:
> On Jun 9, 12:40am, Vadim A. Misbakh-Soloviov wrote:
> }
> }
> } I experienced some issue, related to completion. Here is some summarizing
> of my debug-digging: }
> } > _arguments:comparguments:312: invalid option definition: -V[N]fname[Be
> verbose (level N) (log messages to fname)]
> 
> This is a help message from "vim".  Since the default _vim completion
> function does not attempt to parse the output of "vim --help", this
> must be coming from some other completion function that you have in your
> $fpath.  You will need to contact whoever wrote that function and get
> them to fix it.
> 
> If you're seeing the above error when completing after a command other
> than "vim" (or an alias for vim), then something else is messed up.
> 
> The output of this might be helpful:
> 
>     which-completion() {
> 	emulate -R zsh
> 	print -l ${(u~):-${^fpath}/${(v)^_comps[(I)(|*,)$1(,*|)]}(N-.)}
>     }
> 
> Run that as e.g.
> 
>     which-completion vim
> 
> to see which function is being called for completion of the "vim" command.


Actually,
$ which-completion vim
/usr/share/zsh/5.0.5/functions/Completion/Unix/_vim
$ qfile /usr/share/zsh/5.0.5/functions/Completion/Unix/_vim
app-shells/zsh (/usr/share/zsh/5.0.5/functions/Completion/Unix/_vim)

# it belongs to default zsh "box", so, it probably, someone of zsh devs.
Unfortunately it is no authorship comments in the file and, I can't lurk into 
zsh's vcs to find it out at the moment...


But, anyway, thanks alot fr you help!

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: completion issue
  2014-06-08 19:51   ` Vadim A. Misbakh-Soloviov
@ 2014-06-08 20:11     ` Frank Terbeck
  2014-06-08 21:04     ` Bart Schaefer
  1 sibling, 0 replies; 7+ messages in thread
From: Frank Terbeck @ 2014-06-08 20:11 UTC (permalink / raw)
  To: Vadim A. Misbakh-Soloviov; +Cc: zsh-users

Vadim A. Misbakh-Soloviov wrote:
[...]
>> to see which function is being called for completion of the "vim" command.
>
>
> Actually,
> $ which-completion vim
> /usr/share/zsh/5.0.5/functions/Completion/Unix/_vim
> $ qfile /usr/share/zsh/5.0.5/functions/Completion/Unix/_vim
> app-shells/zsh (/usr/share/zsh/5.0.5/functions/Completion/Unix/_vim)
>
> # it belongs to default zsh "box", so, it probably, someone of zsh devs.
> Unfortunately it is no authorship comments in the file and, I can't lurk into 
> zsh's vcs to find it out at the moment...

Just to make sure: Did this per chance happen after an upgrade of zsh?
If so, try this:

  % rm ~/.zcompdump
  % exec zsh

And see if the problem persists.


Regards, Frank


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

* Re: completion issue
  2014-06-08 19:51   ` Vadim A. Misbakh-Soloviov
  2014-06-08 20:11     ` Frank Terbeck
@ 2014-06-08 21:04     ` Bart Schaefer
  1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2014-06-08 21:04 UTC (permalink / raw)
  To: Vadim A. Misbakh-Soloviov, zsh-users

On Jun 9,  2:51am, Vadim A. Misbakh-Soloviov wrote:
}
} $ which-completion vim
} /usr/share/zsh/5.0.5/functions/Completion/Unix/_vim

OK, the next thing to try is to invoke _complete_debug by typing ^X?
(ctrl+q questionmark) instead of TAB.  This will dump a trace of the
completion process to a temp file, you can then search that temp file
for your error message and see which function is causing it.

Frank's suggestion of removing .zcompdump is also worthwhile.


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

* Re: completion issue
  2014-06-08 17:40 completion issue Vadim A. Misbakh-Soloviov
  2014-06-08 19:27 ` Bart Schaefer
@ 2014-06-11  9:06 ` Vadim A. Misbakh-Soloviov
  2014-06-11 17:29   ` Bart Schaefer
  1 sibling, 1 reply; 7+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2014-06-11  9:06 UTC (permalink / raw)
  To: zsh-users

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

Little update:
I just fuound, that problem is in my
> zstyle ':completion:::::' completer _expand _force_rehash _complete _ignored _gnu_generic _approximate
> zstyle ':completion:*' completer _complete _ignored _gnu_generic _approximate _oldlist _force_rehash
and exactly in
> _gnu_generic
Which is in default Zsh box too, and contains only:
> _arguments '*:arg: _default' --

And, as I understand, the bug is in format of vim's --help:
> -V[N][fname]         Be verbose [level N] [log messages to fname]

And zsh doesn't like [] there and tries to interprete it as it's completion syntax (which is wrong).

So, as I understand, we need to somehow escape such symbols in "--help" output. Unfortunately, I've no idea how.

Could you help me, please?



Btw, it is also one more thing: in russian locale output of `vim --help` contains line separation (\n) on some lines (probably, because it tries to fit 80 cols despite of real terminal size).
So, when zsh parses it in _gnu_generic line-by-line it misses that parts on new lines. Is it possible to fix that too somehow?


В письме от Пн, 9 июня 2014 00:40:01 пользователь Vadim A. Misbakh-Soloviov написал:
> Hi there!
> 
> I experienced some issue, related to completion. Here is some summarizing of
> my debug-digging:
> When I have any (or both, like in my usual .zshrc) line of:
> > zstyle ':completion:::::' completer _expand _force_rehash _complete
> > _ignored _gnu_generic _approximate
> or:
> > zstyle ':completion:*' completer _complete _ignored _gnu_generic
> > _approximate _oldlist _force_rehash
> and trying to call completion of, for example, non-existant path on FS, I get error:
> > _arguments:comparguments:312: invalid option definition: -V[N]fname[Be
> > verbose (level N) (log messages to fname)]
> When I have also:
> > zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} r:|[._-]=**
> > r:|=**' 'm:{a-z}={A-Z} m:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=** l:|=*'
> > 'm:{a-zA-Z}={A-Za-z} r:|[._-]=** r:|=** l:|=*' 'm:{a-zA-Z}={A-Za-z}
> > r:|[._-]=** r:|=** l:|=*'
> in my .zshrc then quoted error duplicates 4 times in a row.
> 
> Is it any way to fix it, but keep effects of that configuration?
> 
> 
> Thanks!

-- 
Best regsrds,
mva

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: completion issue
  2014-06-11  9:06 ` Vadim A. Misbakh-Soloviov
@ 2014-06-11 17:29   ` Bart Schaefer
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2014-06-11 17:29 UTC (permalink / raw)
  To: Vadim A. Misbakh-Soloviov, zsh-users

On Jun 11,  4:06pm, Vadim A. Misbakh-Soloviov wrote:
}
} Little update:
} I just fuound, that problem is in my
} > zstyle ':completion:::::' completer _expand _force_rehash _complete _ignored _gnu_generic _approximate
} > zstyle ':completion:*' completer _complete _ignored _gnu_generic _approximate _oldlist _force_rehash

Ah ... _gnu_generic is not intended to be placed in the "completer" style.
It's designed to be called from (or in place of) a completion function
for a specific command.  There are some special requirements needed for
functions in the "completer" style that most of the other functions do
not meet; a few work anyway by accident, but _gnu_generic is not one.

Hence the _gnu_generic documentation note that says:

     The completion system as supplied is conservative in its use of
     this function, since it is important to be sure the command
     understands the option `--help'.

This could probably go on to say that the command must not merely
understand --help, it must produce the help output in the specific
formatting that FSF software normally employs.

The actual --help parser is in the _arguments function itself.  Look for
this comment:

    # Now get the long option names by calling the command with `--help'.
    # The parameter expansion trickery first gets the lines as separate
    # array elements. Then we select all lines whose first non-blank
    # character is a hyphen. Since some commands document more than one
    # option per line, separated by commas, we convert commas into
    # newlines and then split the result again at newlines after joining 
    # the old array elements with newlines between them. Then we select
    # those elements that start with two hyphens, remove anything up to
    # those hyphens and anything from the space or tab after the
    # option up to the end.


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

end of thread, other threads:[~2014-06-11 17:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-08 17:40 completion issue Vadim A. Misbakh-Soloviov
2014-06-08 19:27 ` Bart Schaefer
2014-06-08 19:51   ` Vadim A. Misbakh-Soloviov
2014-06-08 20:11     ` Frank Terbeck
2014-06-08 21:04     ` Bart Schaefer
2014-06-11  9:06 ` Vadim A. Misbakh-Soloviov
2014-06-11 17:29   ` 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).