From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16268 invoked from network); 17 Sep 1999 09:05:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Sep 1999 09:05:07 -0000 Received: (qmail 10169 invoked by alias); 17 Sep 1999 09:04:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7902 Received: (qmail 10161 invoked from network); 17 Sep 1999 09:04:51 -0000 Date: Fri, 17 Sep 1999 11:04:42 +0200 (MET DST) Message-Id: <199909170904.LAA02257@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Adam Spiers's message of Thu, 16 Sep 1999 16:38:23 +0100 Subject: Re: PATCH: _mutt, _mailboxes Adam Spiers wrote: > Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote: > > And while I'm at it... I'm the only one who writes option > > descriptions, it seems, which I can understand considering how tedious > > that is. So my question is: if an option gets only one argument, > > should we turn it's description automatically into the > > option-description? Probably prefixed by something like `specify: '? > > Sounds like a good idea. How about a configuration key which in this > case would be something like `specify: %s'? Yep. It's `autodescribe_options' (and the sequence is `%d', for `description'). Bye Sven diff -u oldcompletion/Base/_arguments Completion/Base/_arguments --- oldcompletion/Base/_arguments Fri Sep 17 09:32:37 1999 +++ Completion/Base/_arguments Fri Sep 17 10:55:39 1999 @@ -217,6 +217,10 @@ if [[ "$1" = *\[*\](|:*) ]]; then descr="${${1#*\[}%%\]*}" 1="${1/\[$descr\]}" + elif [[ -n "$compconfig[autodescribe_options]" && + "$1" = [-+][^:]##:[^:]#[^\\]:[^:]# ]]; then + descr="${${(M)${1#*:}#*[^\\]:}[1,-2]}" + descr="${compconfig[autodescribe_options]//\\%d/$descr}" fi # Description for both the `-foo' and `+foo' form? diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo --- od/Zsh/compsys.yo Fri Sep 17 10:29:27 1999 +++ Doc/Zsh/compsys.yo Fri Sep 17 11:01:21 1999 @@ -799,7 +799,12 @@ explanation strings should be printed when options are listed. If it is set to a non-empty string and it doesn't contain the substring `tt(!)var(command)', where `var(command)' is the name of the command -that is completed for, the descriptions will be shown. +that is completed for, the descriptions will be shown. If no +explanation string is given but the tt(autodescribe_options) key is +set and only one argument is described for this var(opt-spec), the +option will be described by the value of tt(autodescribe_options) with +any appearance of the sequence `tt(%d)' in it replaced by the +description for the first argument. ) enditem() @@ -1165,6 +1170,13 @@ listed. If the value string contains substrings of the form `tt(!)var(command)', this will not be done for any of these var(command)s. +) +item(tt(autodescribe_options))( +If set, this string will be used as the description for options which +are not described by the completion function, but that have exactly +one argument. The sequence `tt(%d)' in the value will be replaced by +the description for this argument. Depending on personal preferences, +it may be useful to set this key to something like `tt(specify: %d)'. ) item(tt(describe_values))( Like tt(describe_options), but used when completing value lists. -- Sven Wischnowsky wischnow@informatik.hu-berlin.de