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=1466521449; bh=NEXI/1x/3lk8cyz+jmv4C+1Pec8HAtMTk0XUHz2CgjM=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=lZOjbxnic2KmRa6WGY80Bpks+5dfaloE0SpPeq+CRbQ9aWPEpOBv/+MdpIM0uD3aLKVbUQTVxJjZfFlNHKmjIcu3OIBbwwN47dBMdk2hVZ/IXwo8Zu9H/WGf7IQHSkaGKfp860vOQn8zxG+qn6RBJbd34YsmMASrunx4BMg8Qd3zQ3rXJavGAabY8VoWJTbTG7W8F1p1GTu58Cm0U1uMdfa+yNDfowqAJVfapJJw1IfLfu+QjzwLvc13U52wje3r4EvgwvVcl2DqNNfudEJ9mXVF2/GCQ/2Qh6PNkgrX/d1oYRW+6X7AdDj+IX0yNMhIM/uonfP5xlOQUUfP5xQXeA==
X-Yahoo-Newman-Id: 773406.40578.bm@smtp147.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: 7yezFjsVM1nkMAghwRYEcAQ.k0taPkbTd7RmA_8SK0U2V57
 5MMgpH0YYRjMQCPLKARipqbdP1nryHO8mKV9MeSAcN3lep5c0Jj9YjAQlqvN
 TMEwSbaUJyLAR0xvSTaagkeGR7rJYCPcMiF_RZgIXD8HTHXhzqogsKti6p4f
 18qvRzsQpMR3nc7wzDOxKaQvZxFu0zhCQKTwLSm87Sh5PrAkr9wUnd_TV2sx
 AlPaqelhGXcjXmZaK6Pl4XVpO4OOGATXdkkqXnC0r4SoGOn1kJ30UvuuXxb2
 oTdny6i97wqaoj94ImksdFOBl7WNfgRq6pCGf71tO5TAJg_TzyCbWp7YDvDz
 oYSE3s6pLSKfACCY8xq4_c4TtUbk8ZTJmgdLJHIUdIPTBDic88Aggq.8IJBr
 8Sl7NMzWnOuzHyh3Pw87IPmgmUGXwoWItFbUw6G5wvESMUp3f3xWc4DZU_zF
 a4DCbPXMy4WIok8ZGeQ_wDBVT_KJMZTtPMPMeQ.ZaWi70P4eKbEIqOO0z0_S
 Jr61E8i68vUoeX5hkP_LAkEJWJ.Sgpw--
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
In-reply-to: <20160621014132.GC17100@tarsus.local2>
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> <20160621014132.GC17100@tarsus.local2>
To: zsh-workers <zsh-workers@zsh.org>
Subject: Re: Regression: broken completion on modification time
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-ID: <20079.1466519466.1@thecus.kiddle.eu>
Content-Transfer-Encoding: 8bit
Date: Tue, 21 Jun 2016 16:31:06 +0200
Message-ID: <20080.1466519466@thecus.kiddle.eu>
X-Seq: zsh-workers 38735

Daniel Shahaf wrote:
> Change it how?  I don't see how max-verbose and extra-verbose can be
> combined, since the former is an int and the latter a bool.

Ah, ok. I didn't check out the details of max-verbose.

> Another display option would be to use a dummy "string without a match"
> as Bart said (compadd -E1) for something like
>
>     → sense
>     (for the "exactly" sense, skip/omit this field)

I've gone with "sense [default exactly]" as the explanation heading.
We've used square brackets to indicate defaults elsewhere.
The patch now also covers find.

Oliver

diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index e736f32..3854d6c 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -1,7 +1,7 @@
 #compdef find gfind
 
-local curcontext="$curcontext" state_descr variant
-local -a state line args alts
+local curcontext="$curcontext" state_descr variant default
+local -a state line args alts disp smatch
 
 _pick_variant -r variant gnu=GNU $OSTYPE -version
 
@@ -101,7 +101,7 @@ case $variant in
       '-D[print diagnostics]:debug option:(help tree search stat rates opt exec)'
       '-O+[enable query optimisation]:level:(1 2 3)'
       '*-daystart'
-      '-regextype:regexp syntax:(emacs posix-awk posix-basic posix-egrep posix-extended)'
+      '-regextype:regexp syntax:(help findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)'
       '*-warn'
       '*-nowarn'
       '*-xautofs'
@@ -147,13 +147,21 @@ _arguments -C $args \
   '*-user:user:_users' \
   '*-xdev' \
   '*-a' '*-o' \
-  '*:directory:_files -/'
+  '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/'
 
 if [[ $state = times ]]; then
   if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then
-    disp=( 'before' 'exactly' 'since' )
     compstate[list]+=' packed'
-    alts=( "senses:sense:compadd -V times -S '' -d disp - + '' -" )
+    if zstyle -t ":completion:${curcontext}:senses" verbose; then
+      zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
+      default=" [default exactly]"
+      disp=( "- $sep before" "+ $sep since" )
+      smatch=( - + )
+    else
+      disp=( before exactly since )
+      smatch=( - '' + )
+    fi
+    alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" )
   fi
   alts+=( "times:${state_descr}:_dates -f d" )
   _alternative $alts
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index ed9c008..6eef168 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -1,7 +1,7 @@
 #autoload
 
-local state=qual expl char delim timespec
-local -a alts tdisp sdisp
+local state=qual expl char delim timespec default
+local -a alts tdisp sdisp tmatch smatch
 local -A specmap
 
 while [[ -n $PREFIX ]]; do
@@ -118,11 +118,27 @@ while [[ -n $PREFIX ]]; do
       timespec=$PREFIX[1]
       if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then
 	tdisp=( seconds minutes hours days weeks Months )
-        alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' - s m h d w M" )
+	tmatch=( s m h d w M )
+	if zstyle -t ":completion:${curcontext}:time-specifiers" verbose; then
+	  zstyle -s ":completion:${curcontext}:time-specifiers" list-separator sep || sep=--
+          print -v tdisp -f "%s ${sep//(#m)[%\\]/$MATCH$MATCH} %s\0" ${tmatch:^^tdisp}
+	  tdisp=( ${(0)tdisp} )
+	fi
+	alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' -a tmatch" )
       fi
       if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
 	sdisp=( before exactly since )
-        alts+=("senses:sense:compadd -E 0 -d sdisp -S '' - + '' -")
+	smatch=( - '' + )
+	if zstyle -t ":completion:${curcontext}:senses" verbose; then
+	  zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
+	  default=" [default exactly]"
+	  sdisp=( "- $sep before" "+ $sep since" )
+	  smatch=( - + )
+	else
+	  sdisp=( before exactly since )
+	  smatch=( - '' + )
+	fi
+        alts+=( "senses:sense${default}:compadd -E 0 -d sdisp -S '' -a smatch" )
       fi
       specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days)
       alts+=('digits:digit ('${${specmap[(K)${timespec:-d}]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )

