From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3835 invoked from network); 1 Feb 2001 14:55:11 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Feb 2001 14:55:11 -0000 Received: (qmail 2048 invoked by alias); 1 Feb 2001 14:55:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13420 Received: (qmail 2026 invoked from network); 1 Feb 2001 14:55:00 -0000 Message-ID: <3A7978BE.2000700@u.genie.co.uk> Date: Thu, 01 Feb 2001 14:54:54 +0000 From: Oliver Kiddle User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; 0.7) Gecko/20010109 X-Accept-Language: en MIME-Version: 1.0 To: zsh-workers@sunsite.dk Subject: PATCH: new _tin Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Firstly, hello everyone. I'm now back from my time away. I've written a new completion function for the tin newsreader. Hopefully, I've not forgotten too much since I was last writing these functions. I'm not convinced that I've done the best job of it though. Is it wise to be separating the hostnames and nicknames for the news servers rather than completing them together under one title? Is it okay to overload tag names for unrelated things - 'nicknames' is also used for NIS stuff. I'm also not too happy with the way this deals with an empty or non-existant newsrctable file. Why when completing newsgroups (the final part of _arguments) does it display just 'newsgroup' instead of 'Completing newsgroup' when I have zstyle ':completion:*' format 'Completing %d'? I thought about completing newsgroups properly using something like: : ${(A)_cache_newsgroups:=${${(f)"$(fgrep -v \! ~/.newsrc)"}%:*}} _multi_parts -i . _cache_newsgroups but I'm not too sure how consistent the .newsrc file format is. Can anyone confirm if this would work with slrn. Note that I've removed unsubscribed newsgroups here because otherwise it is painfully slow. I realise that fgrep isn't necessary for this but it is a lot quicker than doing it directly with zsh. Is it worth including this as an _newsgroups? Oliver Index: Completion/User/_tin =================================================================== RCS file: _tin diff -N _tin --- /dev/null Mon Dec 11 17:26:27 2000 +++ Completion/User/_tin Thu Feb 1 06:46:44 2001 @@ -0,0 +1,52 @@ +#compdef tin rtin + +local newshosts expl state line curcontext="$curcontext" ret=1 + +_arguments -C -s \ + '-a[toggle color flag]' \ + '-A[force authentication on connect]' \ + '-c[mark all news as read in subscribed groups]' \ + "-d[don't show newsgroup descriptions]" \ + '-f[specify newsrc file to use]:newsrc file:_files' \ + '-G[specify limit to articles/group to get]:number of articles/group to get' \ + '-g[specify NNTP server]:NNTP server:->newshosts' \ + '-h[display help on tin usage]' \ + '-H[display help information]' \ + '-I[specify news index file directory]:news index file directory:_files -/' \ + '-l[get number of articles per group from the active file]' \ + '-m[specify mailbox directory]:mailbox directory:_files -/' \ + '-M[mail new news to specified user]:user:_users' \ + '-n[only read subscribed groups from server]' \ + '-N[mail new news to yourself]' \ + '-o[post all postponed articles and exit]' \ + '-p[specify port to connect to NNTP server]:NNTP port:_ports' \ + "-q[don't check for new newsgroups]" \ + '-Q[quick start. Same as -nqd]' \ + ${${service:#r*}:+-r\[read news remotely over NNTP\]} \ + '-R[read news saved with -S]' \ + '-s[specify saved news directory]:saved news directory:_files -/' \ + '-S[save new news for later reading]' \ + '-u[update index files]' \ + '-U[update index files in the background while reading news]' \ + '-v[verbose output in batch mode]' \ + '-V[display version information]' \ + '-w[post an article and exit]' \ + "-X[don't save any files on quit]" \ + '-z[start if any unread news]' \ + '-Z[return status to indicate if any unread news]' \ + '::newsgroup' && return 0 + +if [[ "$state" = newshosts ]]; then + newshosts=( ${${(f)"$(<~/.tin/newsrctable)"}%%\#*} ) 2>/dev/null + _tags hosts nicknames + while _tags; do + _requested hosts expl 'NNTP server hostname' \ + compadd ${=newshosts#*[[:blank:]]##[^[:blank:]]*[[:blank:]]} && ret=0 + _requested nicknames expl 'NNTP server nickname' \ + compadd -M 'r:|.=* r:|=*' ${newshosts%%[[:blank:]]*} && ret=0 + (( ret )) || return 0 + done +fi + +return 1 +