summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-08-02 22:20:45 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-08-02 22:20:45 +0000
commit3d215fd53ed47cbec57283509b2b3c36165303dd (patch)
tree7932e2e52958850f1a192f11f4f116acd6be9b25
parent4a4fb9f77efb04c90ad8d9dfeb556842e22df013 (diff)
downloadzsh-3d215fd53ed47cbec57283509b2b3c36165303dd.tar.gz
zsh-3d215fd53ed47cbec57283509b2b3c36165303dd.tar.xz
zsh-3d215fd53ed47cbec57283509b2b3c36165303dd.zip
22579: find .pod files in include path for perldoc
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_perldoc2
-rw-r--r--Completion/Unix/Type/_perl_modules23
3 files changed, 22 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b95ac157..7e2bb5db1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-08-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 22579: Completion/Unix/Command/_perldoc,
+	Completion/Unix/Type/_perl_modules: find .pod files in perl
+	include path for documentation.
+
 	* 10570: Completion/Unix/Command/_subversion: handle "svn import"
 	better.
 
diff --git a/Completion/Unix/Command/_perldoc b/Completion/Unix/Command/_perldoc
index 7a3d806c5..8c816b502 100644
--- a/Completion/Unix/Command/_perldoc
+++ b/Completion/Unix/Command/_perldoc
@@ -49,7 +49,7 @@ case  $state in
           _files -g "*.(pod|pm)(-.)" && ret=0
     else
       _alternative \
-	'modules:module: _perl_modules' \
+	'modules:module: _perl_modules -tP' \
 	'pods:base pod: _perl_basepods' \
 	'files:module or .pod file:_files -g "*.(pod|pm)(-.)"' && ret=0
     fi
diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules
index 4ed06ff31..ba88d8d52 100644
--- a/Completion/Unix/Type/_perl_modules
+++ b/Completion/Unix/Type/_perl_modules
@@ -6,7 +6,12 @@
 #
 # Calculate all installed Perl modules.  The result is cached
 # for future use.
-#
+# 
+# Options:
+# 
+# -t[types]: indicate file types; currently the only one is -tP,
+# to include .pod files as well as modules.
+# 
 # Available styles:
 #
 # * try-to-use-pminst
@@ -20,22 +25,28 @@
 _perl_modules () {
   # Set a sensible default caching policy.  This has to be done inside
   # this function otherwise we wouldn't know the context for the style.
-  local update_policy
+  local update_policy sufpat=".pm" with_pod
   zstyle -s ":completion:${curcontext}:" cache-policy update_policy
   if [[ -z "$update_policy" ]]; then
     zstyle ":completion:${curcontext}:" cache-policy \
       _perl_modules_caching_policy
   fi
 
+  if [[ $argv[-1] = -tP ]]; then
+    argv=("${(@)argv[1,-2]}")
+    sufpat="(.pm|.pod)"
+    with_pod=_with_pod
+  fi
+
   local perl=${words[1]%doc} perl_modules
   if whence $perl >/dev/null; then
-    perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules
+    perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod
   elif (( ${+commands[perl]} )); then
     perl=perl
-    perl_modules=_perl_modules
+    perl_modules=_perl_modules$with_pod
   else
     perl=
-    perl_modules=_unknown_perl_modules
+    perl_modules=_unknown_perl_modules$with_pod
   fi
 
   if ( [[ ${(P)+perl_modules} -eq 0 ]] || _cache_invalid $perl_modules ) &&
@@ -68,7 +79,7 @@ _perl_modules () {
 
         # Find all modules
         if [[ -d $libdir && -x $libdir ]]; then
-          new_pms=( $libdir/{[A-Z]*/***/,}*.pm~*blib* )
+          new_pms=( $libdir/{[A-Z]*/***/,}*${~sufpat}~*blib* )
           new_pms=( "${(@)new_pms##$libdir/##}" )
         fi