Sorry for the bad patch. Better version attached.<div><br></div><div>Issue described in more details here:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>please do not expand leading tildes</div><div>
<a href="https://bugs.launchpad.net/bash-completion/+bug/324505">https://bugs.launchpad.net/bash-completion/+bug/324505</a></div></blockquote><div><div><br></div><div>Test cases (before - before patch, after - after patch):</div>
<div><br></div><div><div>1. What:   vim ~/<TAB></div><div>   Before: vim /home/mice/</div><div>   After:  vim ~/</div><div><br></div><div>2. What:   vim ~/<TAB><TAB></div><div>   Before: vim /home/mice/</div>
<div>           + list of folders and files</div><div>   After:  vim ~/</div><div>           + list of folders and files</div><div><br></div><div>3. What:   vim ~/Doc</div><div>   Before: vim /home/mice/Documents/</div><div>
   After:  vim ~/Documents/</div></div><div><br></div><div>---- ---- ---- ----<br><div><br></div><div><div>From ad35b81343a1f00000c8ebc40ff1efe613597123 Mon Sep 17 00:00:00 2001</div><div>From: "wonder.mice" <<a href="mailto:wonder.mice@gmail.com">wonder.mice@gmail.com</a>></div>
<div>Date: Thu, 6 Sep 2012 00:47:22 +0400</div><div>Subject: [PATCH] Fixed tilde expanding in _filedir_xspec</div><div><br></div><div>With this patch completions that use _filedir_xspec will not expand</div><div>tilde when "expand-tilde" option is set to off.</div>
<div><br></div><div>This patch fixes:</div><div><br></div><div>1. What:   vim ~/<TAB></div><div>   Before: vim /home/mice/</div><div>   After:  vim ~/</div><div><br></div><div>2. What:   vim ~/<TAB><TAB></div>
<div>   Before: vim /home/mice/</div><div>           + list of folders and files</div><div>   After:  vim ~/</div><div>           + list of folders and files</div><div><br></div><div>3. What:   vim ~/Doc</div><div>   Before: vim /home/mice/Documents/</div>
<div>   After:  vim ~/Documents/</div><div>---</div><div> bash_completion |    2 +-</div><div> 1 file changed, 1 insertion(+), 1 deletion(-)</div><div><br></div><div>diff --git a/bash_completion b/bash_completion</div><div>
index f3488ba..335f7a3 100644</div><div>--- a/bash_completion</div><div>+++ b/bash_completion</div><div>@@ -1800,7 +1800,7 @@ _filedir_xspec()</div><div>     local cur prev words cword</div><div>     _init_completion || return</div>
<div> </div><div>-    _expand || return 0</div><div>+    _tilde "$cur" || return 0</div><div> </div><div>     local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp</div><div>     local -a toks</div><div>-- </div>
<div>1.7.9.5</div></div><div><br><br><div class="gmail_quote">On Wed, Sep 5, 2012 at 6:00 PM, Igor Murzov <span dir="ltr"><<a href="mailto:e-mail@date.by" target="_blank">e-mail@date.by</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Sun, 26 Aug 2012 16:20:37 +0400<br>
"wonder.mice" <<a href="mailto:wonder.mice@gmail.com">wonder.mice@gmail.com</a>> wrote:<br>
<br>
> As I understand, this patch solves "Please do not expand leading tildes"<br>
> problem when _filedir_xspec is used (for vim, for example).<br>
><br>
> ---<br>
><br>
> diff --git a/bash_completion b/bash_completion<br>
> index b58e37e..912a8e6 100644<br>
> --- a/bash_completion<br>
> +++ b/bash_completion<br>
> @@ -1596,7 +1596,7 @@ _filedir_xspec()<br>
>       COMPREPLY=()<br>
>       _get_comp_words_by_ref cur<br>
><br>
> -    _expand || return 0<br>
> +    _tilde "$cur" || return 0<br>
><br>
>       # get first exclusion compspec that matches this command<br>
>       xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print<br>
> \$0; exit }" \<br>
<br>
</div>The patch does not apply. You should start your work of the 'master'<br>
branch on git://<a href="http://anonscm.debian.org/bash-completion/bash-completion.git" target="_blank">anonscm.debian.org/bash-completion/bash-completion.git</a><br>
Also, the title is not clear. Please describe what issue you are<br>
trying to fix with this patch or submit some tests that this patch fixes.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
-- Igor<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On 08/25/2012 07:53 PM, wonder.mice wrote:<br>
> > Hello,<br>
> ><br>
> > I would like to fix issue with expanding '~' by several completion<br>
> > scripts:<br>
> > #489720 [m|U☹|=↝] [bash-completion] bash-completion: Please do not<br>
> > expand leading tildes<br>
> > #521406 [m|U☹|=↝] [bash-completion] bash-completion: leading tilde<br>
> > always expanded<br>
> > please do not expand leading tildes<br>
> > <a href="https://bugs.launchpad.net/bash-completion/+bug/324505" target="_blank">https://bugs.launchpad.net/bash-completion/+bug/324505</a><br>
> ><br>
> > As I understand, the problem is in _expand() function that is not<br>
> > always correctly used.<br>
> > For example, in _filedir_xspec() it expands '~' regardless to bind<br>
> > -v|grep expand-tilde option.<br>
> ><br>
> > This patch will not solve problems described above.<br>
> > I'm very new in bash and completion and I want to understand that I<br>
> > got right direction.<br>
> ><br>
> > That patch fixes simple problem:<br>
> > $ vim ~mi<TAB><br>
> > will not expand to<br>
> > $ vim ~mice/<br>
> ><br>
> > ----<br>
> ><br>
> > Use _tilde() to complete '~' and '~xx' like it done in _filedir().<br>
> ><br>
> > diff --git a/bash_completion b/bash_completion<br>
> > index f3488ba..beec07c 100644<br>
> > --- a/bash_completion<br>
> > +++ b/bash_completion<br>
> > @@ -1800,6 +1800,7 @@ _filedir_xspec()<br>
> > local cur prev words cword<br>
> > _init_completion || return<br>
> ><br>
> > + _tilde "$cur" || return 0<br>
> > _expand || return 0<br>
> ><br>
> > local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp<br>
><br>
</div></div></blockquote></div><br></div></div></div>