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

Re: PATCH: zsh and perl



On Nov 14,  1:47pm, Paul Johnson wrote:
}
} 1.  cd was used which called my cd function

I can see where this would be annoying, but somebody else could just as
easily have a function for chdir.  A somewhat better fix would be to use
`builtin cd', but even that is going to call peoples' chpwd functions.

} 2.  with multiple versions of perl around it's nice to complete modules
}     specific to the version of perldoc being used

Everything about this change looks OK except the call to _store_cache,
which I don't think should have the ${(P)...} in the second argument.
Just $perl_modules is needed.

An improvement would be for the first argument to both _retrieve_cache
and _store_cache to be ${perl_modules#_}, to continue using the same
cache name as the previous version of the function.

This patch goes on top of Paul's; I'll commit the end result soon.

Any suggestions for how to avoid the chpwd problem?

--- ../current/Completion/User/_perl_modules	Tue Nov 14 08:02:44 2000
+++ Completion/User/_perl_modules	Tue Nov 14 08:04:47 2000
@@ -42,7 +42,7 @@
   fi
 
   if ( [[ ${(P)+perl_modules} -eq 0 ]] || _cache_invalid $perl_modules ) &&
-     ! _retrieve_cache $perl_modules;
+     ! _retrieve_cache ${perl_modules#_};
   then
     if zstyle -t ":completion:${curcontext}:modules" try-to-use-pminst &&
        (( ${+commands[pminst]} ));
@@ -71,9 +71,9 @@
   
         # Find all modules
         if [[ -d $libdir && -x $libdir ]]; then
-        chdir $libdir
+        builtin cd $libdir
         new_pms=( {[A-Z]*/***/,}*.pm~*blib* )
-        chdir $OLDPWD
+        builtin cd $OLDPWD
         fi
   
         # Convert to Perl nomenclature
@@ -83,7 +83,7 @@
       done
     fi
   
-    _store_cache $perl_modules ${(P)perl_modules}
+    _store_cache ${perl_modules#_} $perl_modules
   fi
   
   local expl

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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