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=yahoo.co.uk; s=s2048; t=1466200973; bh=aCimhlF4osA6YyEUzGKwdMXTrDUq5sN/gpMwQtuoSdw=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=IhqnbMz6EIydazxlvrNUzWgv5WTTktgMT288Hn6uTIyW5U1cevQjMNxw/zWxTQYAzpsBChQZvM7MAyNzXH7iY1EhWzHyS6n7zQnWlxsXaPuGsETP2C9NiFfddnoJYcOKunr37xI6R45Pp9asqGfhYyTzxgp3POVJAdrfcA5OZSIWYHCLjwdm7Y8XBBJPw8/w2GJ5hvWPgbHmM68f0fou3L6JGDQsMNHKJo9YgnDJM9TunhQyGwkUgmjpUhusVrvcigENq9k3u1lO4umXjBFPMiLu5PThQG60UTjcEz7VwrUe9ZSDznYeKnOZwltcNm3dnCUquyhPNnxK4aKtsOSIVg==
X-Yahoo-Newman-Id: 209043.82925.bm@smtp112.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: FTyJDVkVM1l697P5I8HrHMh.Gl4yWNLPD4nrqs1hchQZ.Np
 L1hfRNIJcKG2S5aN_JfMWRhoVK9r5vtGTzRre5hnOfn95w6sS4f06LIfQJyG
 x1ydnzHXIGvEUnB8AmbfOluKB9qAhfIIknMehwTIgzoXqkRbnZs3nQuWG_7J
 XZQCF3_bcIVmL_fMUdscJKk2JnHfER7TMCvWxWs9DNsn4VeQr8s3ridw5dBX
 0PKZW44C77ri5KvklO6_YYH3neUS.xZcTfDWv5XHG5D2_S6dyYTfH80p2fbB
 JkE8zCgo.yyIZypprWAJrGs1mtfXp3dQurzbHSv1HJ5cTBAfMddfnZ7EHftz
 XugQEIpgHLZyHbT5ZJ2WeTQl2U9HiWAtPHkkXDzUlIslcPEcChGydkZ8oSDy
 GmWcyOvDUKf3tqKADFEZse1Ly0260BLEGFWhrx0gcTl5RKieEb8vIXj7r.Hm
 .bFR6p38nN5JtMVaaPX7cNkQZ47q5aP1K5bNTkI0920LZeuLyDB.YA4jlxPL
 DNBR9iBc7jciA5EpulqT0V55Dso2JMA--
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
cc: zsh-workers <zsh-workers@zsh.org>
In-reply-to: <706581466190613@web21m.yandex.ru>
From: Oliver Kiddle <okiddle@yahoo.co.uk>
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>
To: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@yandex.ru>
Subject: Re: Regression: broken completion on modification time
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-ID: <19378.1466200972.1@thecus.kiddle.eu>
Content-Transfer-Encoding: quoted-printable
Date: Sat, 18 Jun 2016 00:02:52 +0200
Message-ID: <19379.1466200972@thecus.kiddle.eu>
X-Seq: zsh-workers 38707

"Nikolay Aleksandrovich Pavlov (ZyX)" wrote:
>
> I would say =E2=80=9Cyes=E2=80=9D just to check what possibilities is it=
 talking about. Question is why would I hit `<Tab>` in first place: if I d=
id not see this discussion I would not ever suggest that completing a (mos=
tly) 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 =E2=
=80=9CCompleting: digit (invalid time specifier)=E2=80=9D (nothing if I us=
e `autoload compinit ; compinit` in `zsh -f`, or =E2=80=9CCompleting: `fil=
es'=E2=80=9D 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.

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=3D( _oldlist _complete ); (( $#SUFFIX )) || reply[1]+=3D( _expa=
nd )'

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=3D1
 # 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] =3D=3D on ]] && compset -P '\=
#'; then
     _globflags && ret=3D0
   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=3D1
   compset -p ${#match[1]}
+  compset -S '[^\)\|\~]#(|\))'
   if [[ $_comp_caller_options[extendedglob] =3D=3D on ]] && compset -P '\=
#'; then
     _globflags && ret=3D0
   else
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globqua=
ls
index 2523eb3..ed9c008 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -125,7 +125,7 @@ while [[ -n $PREFIX ]]; do
         alts+=3D("senses:sense:compadd -E 0 -d sdisp -S '' - + '' -")
       fi
       specmap=3D( M months w weeks h hours m minutes s seconds '(|+|-|d)'=
 days)
-      alts+=3D('digits:digit ('${${specmap[(K)$timespec]}:-invalid time s=
pecifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )
+      alts+=3D('digits:digit ('${${specmap[(K)${timespec:-d}]}:-invalid t=
ime specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )
       _alternative $alts
       return
     fi

