Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: man completion



On 5/16/22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sun, May 15, 2022 at 9:45 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
>>
>> The completion function is calling $(manpath 2>/dev/null), but it's
>> caching the result, so if you change $MANPATH that's not being picked
>> up.
>>
>> It also clobbers the cache if called with the -M or -m options and
>> doesn't reset it, which is clearly wrong.
>
> Here's a patch that attempts to (1) skip the cache entirely if the -M
> option appears and (2) assure a cache miss if $MANPATH has changed.
>
> The question is whether it's worth this much effort to avoid running
> $(manpath 2>/dev/null) every time.
>
> Also ... I didn't change this part, but doing ${(s.:.)...} twice seems
> redundant or even potentially wrong?
>
> +      mp=( ${(s.:.)$(manpath 2>/dev/null)} )
> +      [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} )

As far as I'm aware, it should be impossible for this condition to be
true since (s.:.) on the first line will have removed all colons
already, unless you somehow have IFS set to : without breaking
anything else.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author