Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: cleaner _perl*
- X-seq: zsh-workers 7871
- From: Adam Spiers <adam@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh workers mailing list <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: cleaner _perl*
- Date: Thu, 16 Sep 1999 17:05:52 +0100
- Mail-followup-to: zsh workers mailing list <zsh-workers@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- Reply-to: Adam Spiers <adam@xxxxxxxxxx>
With luck this makes _perl* a bit closer to complying with Sven's
completion style guide. I suspect I haven't taken full advantage of
the full bells and whistles of the more recent _arguments yet.
Index: Completion/User/_perl_basepods
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/User/_perl_basepods,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _perl_basepods
--- Completion/User/_perl_basepods 1999/09/16 11:37:18 1.1.1.1
+++ Completion/User/_perl_basepods 1999/09/16 15:14:00
@@ -27,4 +27,6 @@
fi
fi
-compadd - $_perl_basepods
+local expl
+_description expl "Perl base pods"
+compadd "$expl[@]" - $_perl_basepods
Index: Completion/User/_perl_builtin_funcs
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/User/_perl_builtin_funcs,v
retrieving revision 1.2
diff -u -r1.2 _perl_builtin_funcs
--- Completion/User/_perl_builtin_funcs 1999/09/16 14:13:14 1.2
+++ Completion/User/_perl_builtin_funcs 1999/09/16 15:14:00
@@ -26,4 +26,6 @@
fi
fi
-compadd - $_perl_builtin_funcs
+local expl
+_description expl "Perl built-in functions"
+compadd "$expl[@]" - $_perl_builtin_funcs
Index: Completion/User/_perl_modules
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/User/_perl_modules,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _perl_modules
--- Completion/User/_perl_modules 1999/09/16 11:37:18 1.1.1.1
+++ Completion/User/_perl_modules 1999/09/16 15:14:00
@@ -1,6 +1,5 @@
#compdef pmpath pmvers pmdesc pmload pmexp pmeth pmls pmcat pman pmfunc podgrep podtoc podpath
#
-#
# _perl_modules - zsh completion function
#
# Adam Spiers <adam@xxxxxxxxxx>
@@ -8,8 +7,6 @@
# Calculate all installed Perl modules. The result is cached
# for future use.
#
-# Bugs:
-# - can't cope with multiple installs of Perl
# Change this if you have pminst and want to use it. The zsh code
# actually produces better results because pminst misses modules of
@@ -44,4 +41,6 @@
fi
fi
-compadd - $_perl_modules
+local expl
+_description expl "Perl modules"
+compadd "$expl[@]" - $_perl_modules
Index: Completion/User/_perldoc
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/User/_perldoc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _perldoc
--- Completion/User/_perldoc 1999/09/16 11:37:18 1.1.1.1
+++ Completion/User/_perldoc 1999/09/16 15:14:00
@@ -1,23 +1,26 @@
#compdef perldoc
#
-#
# _perldoc - zsh completion function for perldoc
#
# Adam Spiers <adam@xxxxxxxxxx>
#
-# Behaviour should be roughly equivalent to:
-# compctl -k perl_modules -k perl_basepods -f
-# -x 'c[-1,-f]' -k perl_funcs --
-# + -k man_pages
-# perldoc
+
+_perldoc () {
+ _arguments -s \
+ '-h:help:' \
+ '(-q)-f:Perl built-in function:_perl_builtin_funcs:*:' \
+ '(-f)-q:Perl FAQ keyword:' \
+ '*:Perl pod pages:_perl_pods'
+}
+
+_perl_pods () {
+ local nm="$compstate[nmatches]"
+
+ _perl_modules
+ _perl_basepods
+ _path_files -J 'Perl modules and .pods' -/ -g '*.(pod|pm)'
+
+ [[ nm -ne "$compstate[nmatches]" ]]
+}
-if [[ $CURRENT -eq 3 && $words[2] == '-f' ]]; then
- _perl_builtin_funcs
-elif [[ $CURRENT -eq 3 && $words[2] == '-q' ]]; then
- zle -R "I can't read your mind!"
- return 1
-else
- _perl_modules
- _perl_basepods
- _path_files -/ -g '*.(pod|pm)'
-fi
+_perldoc "$@"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author