From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15970 invoked from network); 19 May 2005 10:20:07 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 May 2005 10:20:07 -0000 Received: (qmail 41043 invoked from network); 19 May 2005 10:20:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 May 2005 10:20:01 -0000 Received: (qmail 17608 invoked by alias); 19 May 2005 10:19:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21266 Received: (qmail 17588 invoked from network); 19 May 2005 10:19:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 May 2005 10:19:57 -0000 Received: (qmail 40655 invoked from network); 19 May 2005 10:19:57 -0000 Received: from mail36.messagelabs.com (193.109.254.211) by a.mx.sunsite.dk with SMTP; 19 May 2005 10:19:50 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-11.tower-36.messagelabs.com!1116497989!17693959!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 11606 invoked from network); 19 May 2005 10:19:49 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-11.tower-36.messagelabs.com with SMTP; 19 May 2005 10:19:49 -0000 Received: from trentino.logica.co.uk ([158.234.142.59]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id j4JAJnZe021570 for ; Thu, 19 May 2005 11:19:49 +0100 Received: from trentino.groupinfra.com (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id CFD623661C for ; Thu, 19 May 2005 12:19:48 +0200 (CEST) X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- From: Oliver Kiddle To: Zsh workers Subject: PATCH: improve completion of mh sequences Date: Thu, 19 May 2005 12:19:48 +0200 Message-ID: <9906.1116497988@trentino.groupinfra.com> X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 _mh now handles the Sequence-Negation profile option. You may want to use ignored-patterns to initially suppress these. I use the following style which also supresses the message numbers: zstyle ':completion::(^approximate*):*:sequences' ignored-patterns '(not*|<->)' It also now copes with '-' for message ranges and `:' which allows the number of messages to be limited. I've also corrected the list of pre-defined message sequences. You may want to use the fake style for the mark command if you have certain favourite sequence names. Oliver Index: Completion/Unix/Command/_mh =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mh,v retrieving revision 1.5 diff -u -r1.5 _mh --- Completion/Unix/Command/_mh 21 Jan 2004 13:53:29 -0000 1.5 +++ Completion/Unix/Command/_mh 19 May 2005 10:13:13 -0000 @@ -1,4 +1,4 @@ -#compdef ali burst dist flist flists folder folders forw comp inc mark refile repl scan show next prev packf rmf rmm pick whom mhn mhpath mhlist mhstore mhshow mhparam mhmail +#compdef ali anno burst comp dist flist flists folder folders forw inc mark mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk next packf pick prev refile repl rmf rmm scan show sortm whom # Completion for all possible MH commands. local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail} @@ -61,9 +61,13 @@ ${${(f)"$(mhparam -all)"}%%:*} elif [[ $service = ali ]]; then _email_addresses -n MH +elif compset -P '*:'; then + _message -e number 'number of messages' else # Generate sequences. - local foldnam folddir f ret + local foldnam folddir f sequences mhneg ret=1 + + compset -P '*-' # ignore start of message range for f in $words; do [[ $f = [@+]* ]] && foldnam=$f @@ -77,13 +81,15 @@ # leaving foldnam empty works here fi + sequences=( ${${(f)"$(mark $foldnam 2>/dev/null)"}%%:*} ) + mhneg="$(mhparam Sequence-Negation)" && sequences=( {,$mhneg}$^sequences ) + sequences+=( all first last prev next ) _tags sequences while _tags; do while _next_label sequences expl sequence; do - compadd "$expl[@]" $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') && - ret=0 - compadd "$expl[@]" reply next cur prev first last all unseen && ret=0 - _path_files "$expl[@]" -W folddir -g '<->(-.)' && ret=0 + compadd -S ' ' -r '-: \t\n\-' "$expl[@]" -a sequences && ret=0 + _path_files -S ' ' -r '-: \t\n\-' "$expl[@]" -W folddir -g '<->(-.)' && + ret=0 done (( ret )) || return 0 done