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

Re: PATCH: _perl_modules assumes it's called by perl



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