Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion after anonymous function



On Wed, Jul 13, 2016 at 7:00 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author