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=1466008379; bh=8fJ2Bi0QoypQPvIITvsTafRQM+5GiYsD6AX69iRQhIw=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=ryDZoXNSXN/kuhDpw4uaYiNVUtyDFPe6Dwevo5cSWd7JUFdQHf4MZBxwbibgujJqPUNJOcq+3o/rz0wIr2tHBWaxcncpr/uA9ip4Zz3J5s3MWJA52OY2FBrTD8zNjv2gmfDeXRGBM9VhIlTjzXcGQ/5dkSBChbtJNZIpLhwtwCHUKlEaXgE4Bn97q8ZVhvapr2zY5b4H6MoLio9DQgHyKLW7MqFB1PSs1awtZTiy0lmMdgZ9xdNDFaNt7FO5IH+D9voo/3OlmFXwbX7TeYQR9ncHmzHzhsX/6FI1x1WaH/sEAaKMz+HkLTN/uyFJELWn+Z4M6yK8OHg0EM3b/hhufg==
X-Yahoo-Newman-Id: 44691.48042.bm@smtp136.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: F74ndcoVM1k8DMqkGIjmtct05hHUtXGWGXi7fAzmdFBvnt9
 6Cw898h3NetjGPbBDJfAjc.mzULoTdwFZZhgxpo8TiNAnt_FuR_futAz7N2i
 1Wc8xu5cJWwh1LFh5.66FZV3D6U11O2WiYbzV6bdAOJgqNBQx7SXs620UlxG
 Vc_FMDWi9OPBAZVEo3l53bYLDxHYqEfVWweL8o4c87TQZ67.gNvy5Jqyi85D
 7c5T2oQ42fFqpkt5caG7y5XTX_tO9PGzu_yG7YztS2CzJetwD1B3TaNgMcET
 rLt4CndWALDQ8C3EcmQR.rLEWgA15eiAum0ojsHzqT2oZm4S3xGYuDlLtsG1
 ht8mI5Y8n7V3K6IKT3D.sKZz_V4nMG6qBrfZ_tqo7KvMW2CMomZcNTDZAuB1
 fj7cPZM7OU5E1yxG2jRzLp4XGb1U4zla4DCPpKReiXqt0FehDDXGLMdaIJEa
 b01dO0Zlh181lufEV4gNlyoHHlp5ck8z6olY4.Ei6WkAUrGmGmPGFeS0TStW
 8EJ1QiJq7EZQm8nTGTsdN8RhvRdKvgA--
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
In-reply-to: <160614091402.ZM17103@torch.brasslantern.com>
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>
To: zsh-workers <zsh-workers@zsh.org>
Subject: Re: Regression: broken completion on modification time
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <9936.1466008377.1@thecus.kiddle.eu>
Date: Wed, 15 Jun 2016 18:32:57 +0200
Message-ID: <9937.1466008377@thecus.kiddle.eu>
X-Seq: zsh-workers 38686

Bart wrote:
> } It should probably at least bail out if the complist module isn't loaded as
> } per this patch. Or have you got any better ideas on what to check for?
>
> You suggested:
> > Looking for select in $_def_menu_style 

I tried a number of combinations to see if this would work. It falls
down where the menu-select widget is used directly. Checking for
$WIDGET wouldn't help with that because the menu-select widget doesn't
cause all the completion functions to run, it just turns on menu
selection with whatever completion list we already have.

Another option would be to set a different value for compstate[list] so
users with default setup get a calendar listed: menu selection is not
actually needed for the calendar to display. I'm not sure this is
especially helpful, however, because it is only by using menu selection
to select a specific date that the function is useful.

> There's also the issue noted in workers/35770 (hopefully zsh.org is back
> up) where the substitution of the descriptions for the actual values
> (e.g. before/since for -/+) is confusing if the "format" style is not
> set and the layout is poor when the "group-name" style is not set.

Not having group-name set results in poor format in general.

Looking back at that mail, the complaint is that it does not tell you
"what the syntax is without selecting the entry itself". I prefer
to keep things compact to allow space for the calendar. How about
using a style such as the following. We have an extra-verbose style in
_path_commands and this uses that though I could be persuaded to use
just verbose. I'll allow time for comments before doing anything for
_find.

Oliver

diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index 2523eb3..4eca7ba 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 -a alts tdisp sdisp tmatch smatch
 local -A specmap
 
 while [[ -n $PREFIX ]]; do
@@ -118,11 +118,26 @@ 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" extra-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" extra-verbose; then
+	  zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
+	  sdisp=( "- $sep before" "+ $sep since" )
+	  smatch=( - + )
+	else
+	  sdisp=( before exactly since )
+	  smatch=( - '' + )
+	fi
+        alts+=( "senses:sense: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]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' )

