Subject: Re: umount /f/b<TAB> -> /foo/bar
From: Daniel Shahaf <[email-masked]>
To: [email-masked]
Date: Sat, 20 Aug 2016 18:12:45 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Bart Schaefer wrote on Fri, Aug 19, 2016 at 22:35:13 -0700:
> On Aug 19,  3:56pm, Daniel Shahaf wrote:
> }
> } +    # This codepath honours any -M matchspec parameters.
> } +    () {
> } +      local -a tmp_buffer
> } +      compadd -A tmp_buffer "$__gopts[@]" -a files
> } +      matches+=( "${(@)tmp_buffer/$canpref/$origpref}" )
> } +    }
> } +  else
> } +    # ### Ideally, this codepath would do what the 'if' above does,
> } +    # ### but telling compadd to pretend the "word on the command line"
> } +    # ### is ${"the word on the command line"/$origpref/$canpref}.
> } +    matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
> } +  fi
> 
> Perhaps some variation on
> 
>     compadd -M "B:${(b)origpref}=${(b)canpref}" -a files
> 
> ??  Some cases of mount point names containing unusual characters might
> be a little weird.

I couldn't get that to work.  Neither did assigning to words[CURRENT].

I'm tempted to push the patch as is, though, since it adds matchspecs
honouring to one use-case and doesn't break others.

Thanks,

Daniel