From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13615 invoked by alias); 25 Aug 2016 01:20:07 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39103 Received: (qmail 7268 invoked from network); 25 Aug 2016 01:20:07 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.26):SA:0(0.0/5.0):. Processed in 0.164846 secs); 25 Aug 2016 01:20:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=3KyOvqM4K0aNgE1ke6jVH53OdyI=; b=a6lxv+ DQVID2SSd+COa7dKAFj318F75NWuw7oN/dCZg6pqwPAs8SssVA3VSXToqcuMnacZ wfW/qP7RTKVGikz7PJwEmyDrjHkZFp/d/WsXtwzEegrEAhDBxXDHq0r+DdEw3maV K76HXTCW6eO70YWJ0JIgHtj2pCFhpv/axTy8k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=3KyOvqM4K0aNgE1ke6jVH53OdyI=; b=G+nEu nYFy9VvR/n4F1xyBrDVlQGj+jlFtvlUvTI49cOfV9h6m4NBlKcdGJ26kkuUcR5sp TE6yysm3dFx33mS47PNZGXSDJzCGlhIfEKKs73cgr0uVJ7cP0xa4lB+eQq/9cgpi gYH4JUhFln6wqsg9mUA4aSSALLiLHmYyzbrjMI= X-Sasl-enc: YeHbRycWuICQgQ0g28SNhi/Q9AfP1bGot40C7qTeE3lR 1472088003 Date: Thu, 25 Aug 2016 01:19:50 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: file completion(?) erases word typed Message-ID: <20160825011950.GA23717@fujitsu.shahaf.local2> References: <20160823224842.GA24864@fujitsu.shahaf.local2> <160823225204.ZM19950@torch.brasslantern.com> <20160824191313.GA31943@fujitsu.shahaf.local2> <160824170454.ZM22771@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160824170454.ZM22771@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Wed, Aug 24, 2016 at 17:04:54 -0700: > On Aug 24, 7:13pm, Daniel Shahaf wrote: > } > } > +_path_files:713> compadd -Qf -J -default- -p usr/local/bin/ -s '' -W /usr/local/bin/ -M 'r:|/=* r:|=*' -a tmp1 > } > > } > I have no idea why ignoring the path minus its leading slash would ever > } > be correct, but in any case this appears to be adding the full path by > } > two different and contradictory approaches. > } > } What _absolute_command_paths intended to be is: > } > } - You can type in an absolute path to an executable file, even if that > } file is not in $PATH or in $commands. > > What's the reason for passing -P / to _path_files in _typed-in_* ? _typed-in_* must complete only absolute paths. The -P / was an attempt to disallow non-absolute paths. Perhaps this would be better? There may be a way to rewrite it without -P entirely, but that evades me at the moment. diff --git a/Completion/Unix/Type/_absolute_command_paths b/Completion/Unix/Type/_absolute_command_paths index e9ab170..f61f04d 100644 --- a/Completion/Unix/Type/_absolute_command_paths +++ b/Completion/Unix/Type/_absolute_command_paths @@ -16,7 +18,13 @@ _hashed_absolute_command_paths() { # This function completes absolute pathnames of executables, e.g., /etc/rc.local _typed-in_absolute_command_paths() { # TODO: the description "full path to an executable" and tag in the caller are ignored by _path_files - _path_files -/ -g '*(-*)' -P / -W / + if [[ -z $PREFIX ]]; then + _path_files -/ -g '*(-*)' -P / -W / + elif [[ $PREFIX[1] == / ]]; then + _path_files -/ -g '*(-*)' -W / + else + return 1 + fi } _absolute_command_paths() { > That's what's causing the strange -p usr/local/bin getting passed to > compadd. Despite what the doc says, _path_files doesn't actually pass > the -P option along to compadd, instead it calls "compset -P" which > makes it an ignored prefix instead. > > I'm still not sure whether (or what) this has to do with the word on > the line disappearing. *nod*