Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: _perl_modules assumes it's called by perl
- X-seq: zsh-workers 48436
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: _perl_modules assumes it's called by perl
- Date: Thu, 8 Apr 2021 02:12:33 +0000
- Archived-at: <https://zsh.org/workers/48436>
- In-reply-to: <728536af-2738-4cdb-bc56-f64b2ab8be30@www.fastmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20210329150644.GA30806@tarpaulin.shahaf.local2> <CAH+w=7ap1534966=vrAW1hFmwY=4LWr6dXoM72oNFPzH0QeGPA@mail.gmail.com> <728536af-2738-4cdb-bc56-f64b2ab8be30@www.fastmail.com>
Daniel Shahaf wrote on Mon, Mar 29, 2021 at 15:28:52 +0000:
> Bart Schaefer wrote on Mon, 29 Mar 2021 15:16 +00:00:
> > On Mon, Mar 29, 2021 at 8:07 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > >
> > \> + if [[ $service == (perl|perldoc) ]]; then
> > > + perl=${${(Q)words[1]}%doc}
> >
> > This still needs to be checked with "whence perl" to make [[ -n $perl
> > ]] have the (intended but messed up) previous semantics.
> >
> > I otherwise agree with the intent of the patch.
>
> Thanks for the review. So, just add «whence -- $perl >/dev/null || perl=» after the quoted assignment?
Interdiff:
diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules
index 02b43366a..3e11de9ea 100644
--- a/Completion/Unix/Type/_perl_modules
+++ b/Completion/Unix/Type/_perl_modules
@@ -61,8 +61,8 @@ _perl_modules () {
fi
local perl perl_modules
- if [[ $service == (perl|perldoc) ]]; then
- perl=${${(Q)words[1]}%doc}
+ if [[ $service == (perl|perldoc) ]] && whence -- ${${(Q)words[1]}%doc} >/dev/null; then
+ perl=$_
perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod
elif whence perl > /dev/null; then
perl=perl
Messages sorted by:
Reverse Date,
Date,
Thread,
Author