From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16578 invoked from network); 4 Nov 2004 10:32:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Nov 2004 10:32:28 -0000 Received: (qmail 37467 invoked from network); 4 Nov 2004 10:32:21 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Nov 2004 10:32:21 -0000 Received: (qmail 20370 invoked by alias); 4 Nov 2004 10:31:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8161 Received: (qmail 20357 invoked from network); 4 Nov 2004 10:31:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Nov 2004 10:31:27 -0000 Received: (qmail 36201 invoked from network); 4 Nov 2004 10:31:27 -0000 Received: from ns9.hostinglmi.net (213.194.149.146) by a.mx.sunsite.dk with SMTP; 4 Nov 2004 10:31:26 -0000 Received: from 212.red-80-35-44.pooles.rima-tde.net ([80.35.44.212]:45276 helo=dervishd.net) by ns9.hostinglmi.net with esmtpa (Exim 4.43) id 1CPetq-00061n-82; Thu, 04 Nov 2004 11:31:26 +0100 Date: Thu, 4 Nov 2004 11:33:58 +0100 From: DervishD To: Bart Schaefer Cc: Zsh Users Subject: Re: Filename expansion within a completion widget Message-ID: <20041104103358.GC23673@DervishD> Mail-Followup-To: Bart Schaefer , Zsh Users References: <20041102233658.GA21654@DervishD> <20041102234409.GB21654@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.1i Organization: DervishD X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns9.hostinglmi.net X-AntiAbuse: Original Domain - sunsite.dk X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - dervishd.net X-Source: X-Source-Args: X-Source-Dir: X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Hi Bart :) * Bart Schaefer dixit: > > > compset -P '*/' > > > > > > Well, it handles both relative and absolute directories > > > correctly, but doesn't handle named directories :(( I don't > > > understand why because if I type 'cd ~X' the named dir should be > > > expanded, shouldn't it? > "Expanded" would mean that ~X was replaced by the path it represents. > Yet later you say this isn't the behavior you want. I didn't explained correctly O:)) I want it expanded within the completion widget, not in the command line. The problem is that the compadd call doesn't work if the WORD has '~' as the first character. I want this: $ cd ~X X11/ usr/ bin/ include/ And after that, insert the completions. If I 'translate' PREFIX so the named dir is expanded, completion works OK, but then I have the named dir translated in the command line. I want to translate it only in the widget so compadd can correctly generate the list. > > Of course, adding something like 'PREFIX=$~PREFIX' just before > > the compset call solves the problem, but then the named dir is > > 'translated', which I don't want > Just because you're not using zsh's completion system functions doesn't > mean you can't look at them for hints. Completion/Unix/Type/_tilde_files > would be a good place to start; note in particular the case statement on > $PREFIX. I'll take a look, but my problem is that I don't understand most of the code. It is not very readable and is quite complex for me O:) But I'll take a look at _tilde_files. Thanks for the reference. > > There is surely another way of doing this... > The short answer is that if there is not a slash in the string yet, you > remove the tilde from consideration with compset -P, and then you compadd > the userdirs and/or nameddirs arrays from the zsh/parameter module. If > there is a slash in the string, you have to manipulate IPREFIX and then > use compadd -W. Thanks a lot, Bart, I'll take a look at _tilde_files and try to get the point. Thanks for coming to the rescue again ;) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.dervishd.net & http://www.pleyades.net/