zsh-workers
 help / color / mirror / code / Atom feed
From: Philippe Troin <phil@fifi.org>
To: Peter Stephenson <pws@csr.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: Preventing sorting in completers
Date: 22 Jul 2003 12:51:09 -0700	[thread overview]
Message-ID: <87oezm5oia.fsf@ceramic.fifi.org> (raw)
In-Reply-To: <14937.1058294147@csr.com>

Any reason why this has not made it into cvs as of July 22 2003?

Phil.

Peter Stephenson <pws@csr.com> writes:

> Bart Schaefer wrote:
> > Slightly revised suggestion:  Allow styles to override an explicit -J,
> > but do not allow overriding an explicit -V.  I did a quick grep, and
> > there are very few cases where the -V option is passed; but in none of
> > those would it be useful to apply a sort.
> 
> I've now ended up with the following.  The special history code is still
> necessary because it reverses the usual default; it assumes you don't
> want it sorted unless you say you do.
> 
> Index: Completion/Base/Core/_description
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_description,v
> retrieving revision 1.4
> diff -u -r1.4 _description
> --- Completion/Base/Core/_description	12 Feb 2002 13:37:03 -0000	1.4
> +++ Completion/Base/Core/_description	15 Jul 2003 18:32:02 -0000
> @@ -1,6 +1,6 @@
>  #autoload
>  
> -local name gropt nopt xopt format gname hidden hide match opts tag
> +local name gropt nopt xopt format gname hidden hide match opts tag sort
>  
>  opts=()
>  
> @@ -30,6 +30,18 @@
>  zstyle -s ":completion:${curcontext}:$1" matcher match &&
>      opts=($opts -M "$match")
>  [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
> +
> +# Use sort style, but ignore `menu' value to help _expand.
> +# Also don't override explicit use of -V.
> +if { zstyle -s ":completion:${curcontext}:$1" sort sort ||
> +     zstyle -s ":completion:${curcontext}:" sort sort; } &&
> +    [[ "$gropt" = -J && $sort != menu ]]; then
> +    if [[ "$sort" = (yes|true|1|on) ]]; then
> +	gropt=(-J)
> +    else
> +	gropt=(-V)
> +    fi
> +fi
>  
>  if [[ -z "$_comp_no_ignore" ]]; then
>    zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
> Index: Doc/Zsh/compsys.yo
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
> retrieving revision 1.171
> diff -u -r1.171 compsys.yo
> --- Doc/Zsh/compsys.yo	7 Jul 2003 09:48:46 -0000	1.171
> +++ Doc/Zsh/compsys.yo	15 Jul 2003 18:32:02 -0000
> @@ -2162,12 +2162,22 @@
>  )
>  kindex(sort, completion style)
>  item(tt(sort))(
> -If set to `true', completing words from the command
> -history sorts the words alphabetically instead of
> -keeping them in the order in which they appear in the history (from
> -youngest to oldest).
> +Many completion widgets call tt(_description) at some point which
> +decides whether the matches are added sorted or unsorted (often
> +indirectly via tt(_wanted) or tt(_requested)).  This style can be set
> +explicitly to one of the usual true or false values as an override.
> +If it is not set for the context, the standard behaviour of the
> +calling widget is used.
>  
> -This is also used by the tt(_expand) completer. If it is set to
> +The style is tested first against the full context including the tag, and
> +if that fails to produce a value against the context without the tag.
> +
> +If the calling widget explicitly requests unsorted matches, this is usually
> +honoured.  However, the default (unsorted) behaviour of completion
> +for the command history may be overridden by setting the style to
> +tt(true).
> +
> +In the tt(_expand) completer, if it is set to
>  `true', the expansions generated will always be sorted.  If it is set
>  to `tt(menu)', then the expansions are only sorted when they are offered 
>  as single strings but not in the string containing all possible


  reply	other threads:[~2003-07-22 19:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87wuenkuod.fsf@ceramic.fifi.org>
2003-07-13 18:17 ` Bart Schaefer
2003-07-14 15:11   ` Peter Stephenson
2003-07-14 16:11     ` Danek Duvall
2003-07-14 16:31       ` Bart Schaefer
2003-07-14 16:41     ` Peter Stephenson
2003-07-14 17:11       ` Bart Schaefer
2003-07-14 17:31         ` Peter Stephenson
2003-07-14 19:14           ` Bart Schaefer
2003-07-15  9:42             ` Peter Stephenson
2003-07-15 16:16               ` Bart Schaefer
2003-07-15 18:35                 ` Peter Stephenson
2003-07-22 19:51                   ` Philippe Troin [this message]
2003-07-23  9:23                     ` Peter Stephenson
2003-07-23 19:12                       ` Philippe Troin
2003-07-24  9:28                         ` CVS (Re: Preventing sorting in completers) Oliver Kiddle
2003-07-14 20:13       ` Preventing sorting in completers Philippe Troin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oezm5oia.fsf@ceramic.fifi.org \
    --to=phil@fifi.org \
    --cc=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).