Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: man completion
- X-seq: zsh-workers 50238
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Karel Balej <karelb@xxxxxxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: man completion
- Date: Mon, 16 May 2022 23:40:19 +0200
- Archived-at: <https://zsh.org/workers/50238>
- In-reply-to: <CAH+w=7Yt84uC0PVNvjoXjh3apmYMgvXNYeSUdqPcg9vaZ4DEKA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20220515152021.pumg2z3fmfga76vp@asfaloth> <CAH+w=7YMj_TnQ5711ZNDZSqPeYyV+4OuwgmtHFmj8qsroDT9BA@mail.gmail.com> <CAH+w=7Yt84uC0PVNvjoXjh3apmYMgvXNYeSUdqPcg9vaZ4DEKA@mail.gmail.com>
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