Subject: Re: Completion after anonymous function
From: Mikael Magnusson <[email-masked]>
To: Daniel Shahaf <[email-masked]>
Cc: zsh workers <[email-masked]>
Date: Wed, 13 Jul 2016 12:47:04 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Wed, Jul 13, 2016 at 7:00 AM, Daniel Shahaf <[email-masked]> wrote:
> «() {} <TAB>» completes as a command position:
>
> % () {} «_complete_help»
> tags in context :completion::complete:-command-::
>     commands builtins functions aliases suffix-aliases reserved-words jobs parameters  (_command_names _autocd)
>     commands                                                                           (_path_commands _command_names _autocd)
>     jobs                                                                               (_jobs _command_names _autocd)
>     parameters                                                                         (_parameters _command_names _autocd)
>
> I guess it should just use _default, like unrecognised command words.
>
> Tracing, _complete sees [[ $compstate[context] == normal ]] — which
> seems correct — and then the «if [[ CURRENT -eq 1 ]]» in _normal is
> entered; I guess that's the problem?

It seems to work fine as long as the body of the anonymous function
isn't either empty or ends with a semicolon, which is probably why
nobody noticed before.

-- 
Mikael Magnusson