From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9002 invoked from network); 1 Apr 2009 10:54:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Apr 2009 10:54:22 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 28114 invoked from network); 1 Apr 2009 10:54:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Apr 2009 10:54:16 -0000 Received: (qmail 11674 invoked by alias); 1 Apr 2009 10:54:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26801 Received: (qmail 11662 invoked from network); 1 Apr 2009 10:54:11 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 1 Apr 2009 10:54:11 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [85.115.60.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 58D7F8026E27 for ; Wed, 1 Apr 2009 12:54:05 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly18d.srv.mailcontrol.com (MailControl) with ESMTP id n31ArxST005764 for ; Wed, 1 Apr 2009 11:53:59 +0100 Received: from news01.csr.com ([10.99.50.25]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 1 Apr 2009 11:53:58 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id n31ArwUf001501 for ; Wed, 1 Apr 2009 11:53:58 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id n31Arwe3001498 for ; Wed, 1 Apr 2009 11:53:58 +0100 X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: _calendar X-Mailer: MH-E 8.0.3; nmh 1.3; GNU Emacs 22.1.1 Date: Wed, 01 Apr 2009 11:53:57 +0100 Message-ID: <1497.1238583237@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 01 Apr 2009 10:53:58.0588 (UTC) FILETIME=[28DA1FC0:01C9B2B8] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.68.0.128 X-Virus-Scanned: ClamAV 0.92.1/9191/Wed Apr 1 09:40:36 2009 on bifrost X-Virus-Status: Clean This adds completion for the calendar function and also makes it possible to trace what precommand modifiers are in effect, so for example we can tell if we're executing an external command with the same name as a function. Index: Completion/Base/Core/_main_complete =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_main_complete,v retrieving revision 1.10 diff -u -r1.10 _main_complete --- Completion/Base/Core/_main_complete 1 Oct 2004 10:29:21 -0000 1.10 +++ Completion/Base/Core/_main_complete 1 Apr 2009 10:45:40 -0000 @@ -32,6 +32,9 @@ _saved_insert="${compstate[insert]}" \ _saved_colors="$ZLS_COLORS" +# _precommand sets this to indicate we are following a precommand modifier +local -a precommands + typeset -U _lastdescr _comp_ignore _comp_colors [[ -z "$curcontext" ]] && curcontext=::: Index: Completion/Unix/Command/_calendar =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_calendar,v retrieving revision 1.1 diff -u -r1.1 _calendar --- Completion/Unix/Command/_calendar 12 Mar 2008 23:35:26 -0000 1.1 +++ Completion/Unix/Command/_calendar 1 Apr 2009 10:45:41 -0000 @@ -1,12 +1,34 @@ #compdef calendar -_arguments \ - '-a[process files of all users]' \ - '-A[print today and the following num days]:number of days:' \ - '-b[enforce special KOI8 date calculation mode]' \ - '-B[print today and the previous num days]:number of days:' \ - '-f[use file as the default calendar]:calendar file:_files' \ - '-l[print today and the following num days]:number of days:' \ - '-w[print today and the following num days only if today is Friday]:number of days:' \ - '-t[act as though today is the date specified]:date:' +if [[ $+functions[calendar] -eq 1 && -z $precommands[(r)command] ]]; then + # The shell function is loaded, and we're not instructed to + # use an external command, so complete that. + _arguments \ + '-a[show all calendar items]' \ + '-b[brief, display first line only]' \ + '-d[move events to done file]' \ + '-D[never move events to done file]' \ + '-r[show all remaining items from start or now]' \ + '-s[use sched to schedule a warning]' \ + '-v[verbose]' \ + '-B[select number of lines to display]:lines: ' \ + '-C[select calendar file]:calendar file:_path_files' \ + '-n[select max number of events]:max number of events: ' \ + '-S[select show programme]:show programme:_command_names' \ + '1:date/time: ' \ + '(-r)2:end date/time: ' +else + # This is only one particular version of calendar. + # Some variant of BSD, I think. + _arguments \ + '-a[process files of all users]' \ + '-A[print today and the following num days]:number of days:' \ + '-b[enforce special KOI8 date calculation mode]' \ + '-B[print today and the previous num days]:number of days:' \ + '-f[use file as the default calendar]:calendar file:_files' \ + '-l[print today and the following num days]:number of days:' \ + '-w[print today and the following num days only if today is Friday]:number of days:' \ + '-t[act as though today is the date specified]:date:' + +fi Index: Completion/Zsh/Command/_command =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_command,v retrieving revision 1.2 diff -u -r1.2 _command --- Completion/Zsh/Command/_command 19 Aug 2007 23:31:31 -0000 1.2 +++ Completion/Zsh/Command/_command 1 Apr 2009 10:45:41 -0000 @@ -2,6 +2,8 @@ local ret +# indicate if this is a precommand modifier +[[ $service = command ]] && precommands+=(command) if [[ CURRENT -ge 3 ]]; then compset -n 2 _normal && ret=0 Index: Completion/Zsh/Command/_precommand =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_precommand,v retrieving revision 1.6 diff -u -r1.6 _precommand --- Completion/Zsh/Command/_precommand 30 Aug 2008 11:49:20 -0000 1.6 +++ Completion/Zsh/Command/_precommand 1 Apr 2009 10:45:41 -0000 @@ -1,5 +1,8 @@ #compdef - nohup eval time rusage noglob nocorrect exec catchsegv aoss +# precommands is made local in _main_complete +precommands+=($words[1]) + shift words (( CURRENT-- )) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070