From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13176 invoked from network); 25 Feb 2000 15:40:08 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Feb 2000 15:40:08 -0000 Received: (qmail 24542 invoked by alias); 25 Feb 2000 15:39:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9879 Received: (qmail 24535 invoked from network); 25 Feb 2000 15:39:43 -0000 Date: Fri, 25 Feb 2000 16:39:40 +0100 (MET) Message-Id: <200002251539.QAA21828@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Alexandre Duret-Lutz's message of 25 Feb 2000 16:23:55 +0100 Subject: Re: PATCH: Re: Questions/comments on completion code that arise from PWS's zsh guide Alexandre Duret-Lutz wrote: > Sven> The patch adds _tilde_files which completes files and expands tildes > Sven> if there are any. And makes _dd use it. > > But this will *always* expand tildes. Since I am using magicequalsubst, > I don't want tildes to be expanded 'on the line' in places where > it would be done by magicequalsubst. > > Shouldn't there be a option to _tilde_files saying that _tilde_files is > called in a context where magicequalsubst will expand the tilde (in which > case _tilde_files should care whether the magicequalsubst is set or not) ? > Or it may be the default. Yes, I think _tilde_files should do that always. > Sven> Does anyone know of other places where this might be useful? > > What happens with _arguments's equal-ended options ? > Should they use _tilde_files instead of _files ? > It may be good that `--prefix=~/usr' get expanded to > `--prefix=/myhomedir/usr' when magicequalsubst is unset, > but I would find strange that `--prefix ~/usr' expands > to `--prefix /myhomedir/usr' too... Hm. Maybe, but not unconditionally because currently _tilde_files always does the expansion, not only if there is a $IPREFIX. The solution would be an option for _tilde_files that makes it do expansion only if the is a IPREFIX (or maybe an option with an argument which is taken as a pattern and _tilde_files expands only if IPREFIX matches that) and changing the actions in the calls to _arguments and _values (unless the commands do tilde-expansion themselves). Bye Sven diff -ru ../z.old/Completion/User/_tilde_files Completion/User/_tilde_files --- ../z.old/Completion/User/_tilde_files Fri Feb 25 14:17:37 2000 +++ Completion/User/_tilde_files Fri Feb 25 16:37:57 2000 @@ -2,7 +2,7 @@ # Complete files and expand tilde expansions in it. -if (( $argv[(I)-W*] )); then +if [[ ( -o magicequalsubst && "$IPREFIX" = *\= ) || $argv[(I)-W*] -ne 0 ]]; then _files "$@" return fi -- Sven Wischnowsky wischnow@informatik.hu-berlin.de