From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11217 invoked from network); 14 Jul 2003 16:41:52 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Jul 2003 16:41:52 -0000 Received: (qmail 10554 invoked by alias); 14 Jul 2003 16:41:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18848 Received: (qmail 10544 invoked from network); 14 Jul 2003 16:41:47 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 14 Jul 2003 16:41:47 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 14 Jul 2003 16:41:46 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.cambridgesiliconradio.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Sun, 13 Jul 2003 17:41:10 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 14 Jul 2003 17:40:38 +0100 To: zsh-workers@sunsite.dk Subject: Re: Preventing sorting in completers In-reply-to: "Peter Stephenson"'s message of "Mon, 14 Jul 2003 16:11:08 BST." <5798.1058195468@csr.com> Date: Mon, 14 Jul 2003 17:41:42 +0100 Message-ID: <15028.1058200902@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 14 Jul 2003 16:40:38.0654 (UTC) FILETIME=[A82251E0:01C34A26] Peter Stephenson wrote: > I suspect what we want to do is test for an explicitly set sort style in > _description and used that to override the default. Then we can all > forget about tweaking the functions. For example, the following very lightly tested function where I've tried not to screw up _expand but fell into apathy at the thought of actually testing whether I had. I think this makes the direct use in _history redundant. 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 14 Jul 2003 16:38:30 -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,16 @@ 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. +if zstyle -s ":completion:${curcontext}:$1" sort sort && + [[ $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 14 Jul 2003 16:38:30 -0000 @@ -2162,12 +2162,19 @@ ) kindex(sort, completion style) item(tt(sort))( -If set to `true', completing words from the command -history sorts the words alphabetically instead of +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. + +When completing words from the command +history, if set to `true' the words are sorted alphabetically instead of keeping them in the order in which they appear in the history (from youngest to oldest). -This is also used by the tt(_expand) completer. If it is set to +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 -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************