Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1466202036;
	bh=gW0qQ7jWM5m7e5cS1ChQyO6BtoZsZ3zmM//RCgY8FE4=;
	h=X-Yandex-Sender-Uid:From:To:Cc:In-Reply-To:References:Subject:
	 MIME-Version:Message-Id:X-Mailer:Date:Content-Transfer-Encoding:
	 Content-Type;
	b=BQlEvtr21UbOJZ7KLVCDaF+omKX6Z8B8FXg7zkfUxYEXaaCEdiRcGyvwdcuZOB/pV
	 3N1VKGGRjt7bbdqaIN8YZgS1Z1b3uB9/3LhP9CRux/q4RDngkcJrKKdxuo+LBqOPOI
	 eUwthu8ZVqCrcz+tA02qOTKzxG/xS5XbIQjp0vWs=
Authentication-Results: mxback3m.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0,1 20735984
X-Yandex-Sender-Uid: 9151298
From: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@yandex.ru>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh-workers <zsh-workers@zsh.org>
In-Reply-To: <19379.1466200972@thecus.kiddle.eu>
References: <87oa76172f.fsf@secretsauce.net> <160612174712.ZM10957@torch.brasslantern.com> <3670.1465855245@thecus.kiddle.eu> <160614091402.ZM17103@torch.brasslantern.com> <9937.1466008377@thecus.kiddle.eu> <20160615232437.GA28886@tarsus.local2> <17354.1466180383@thecus.kiddle.eu> <160617111101.ZM488@torch.brasslantern.com> <706581466190613@web21m.yandex.ru> <19379.1466200972@thecus.kiddle.eu>
Subject: Re: Regression: broken completion on modification time
MIME-Version: 1.0
Message-Id: <910371466202036@web25m.yandex.ru>
X-Mailer: Yamail [ http://yandex.ru ] 5.0
Date: Sat, 18 Jun 2016 01:20:36 +0300
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-Seq: zsh-workers 38708



18.06.2016, 01:09, "Oliver Kiddle" <okiddle@yahoo.co.uk>:
> "Nikolay Aleksandrovich Pavlov (ZyX)" wrote:
>>  I would say “yes” just to check what possibilities is it talking about. Question is why would I hit `<Tab>` in first place: if I did not see this discussion I would not ever suggest that completing a (mostly) numeric and in any case very short argument to `m` has any sense.
>
> It may not be useful to "complete" short things but the descriptions can
> be very useful. There's quite a few cases where this is done, e.g.:
>   printf '%<tab>
>   : ${(<tab>
>   !!:<tab>
>
>>  Also if I write `ls *(m)` with cursor after `m` and hit `<Tab>` I get “Completing: digit (invalid time specifier)” (nothing if I use `autoload compinit ; compinit` in `zsh -f`, or “Completing: `files'” with no list after `unsetopt completeinword`):
>
> Stripping suffixes is easily forgotten when writing completion functions
> and this was one such case. Patch below should fix this and make
> it indicate the default of "days" when there is no time specifier.
>
> With `unsetopt completeinword', you have the equivalent of moving the
> cursor to the end of the word. *(m) is an invalid glob matching no
> files. You might also want to consider using the _prefix completer which
> ignores the entire suffix.
>
>>  Particularly, the most failing thing is `ls foo{bar<Tab>}`: this usually either does nothing or expands immediately if I already happened to write a comma.
>
> Are you using the _expand completer or the default expand-or-complete
> widget to do expansion.

I have `_expand _complete` set as completer zstyle. Though I have rechecked this with “zsh -f; autoload compinit; compinit” before posting, don’t know what is being used here.

>
> Braces are largely handled by internal C code: _prefix doesn't seem able
> to help here. You can prevent the expansion with something like:
>   zstyle -e ':completion:*::::' completer \
>     'reply=( _oldlist _complete ); (( $#SUFFIX )) || reply[1]+=( _expand )'
>
> Oliver
>
> diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
> index fe0780a..6987824 100644
> --- a/Completion/Unix/Type/_files
> +++ b/Completion/Unix/Type/_files
> @@ -7,6 +7,7 @@ local ret=1
>  # we don't want to complete them multiple times (for each file pattern).
>  if _have_glob_qual $PREFIX; then
>    compset -p ${#match[1]}
> + compset -S '[^\)\|\~]#(|\))'
>    if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
>      _globflags && ret=0
>    else
> diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
> index 14c4cc7..6a1e89f 100644
> --- a/Completion/Unix/Type/_path_files
> +++ b/Completion/Unix/Type/_path_files
> @@ -17,6 +17,7 @@ local -a match mbegin mend
>  if _have_glob_qual $PREFIX; then
>    local ret=1
>    compset -p ${#match[1]}
> + compset -S '[^\)\|\~]#(|\))'
>    if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
>      _globflags && ret=0
>    else
> diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
> index 2523eb3..ed9c008 100644
> --- a/Completion/Zsh/Type/_globquals
> +++ b/Completion/Zsh/Type/_globquals
> @@ -125,7 +125,7 @@ while [[ -n $PREFIX ]]; do
>          alts+=("senses:sense:compadd -E 0 -d sdisp -S '' - + '' -")
>        fi
>        specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days)
> - alts+=('digits:digit ('${${specmap[(K)$timespec]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )
> + alts+=('digits:digit ('${${specmap[(K)${timespec:-d}]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )
>        _alternative $alts
>        return
>      fi

