Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 3(b)/3] _man: Support _correct_word.
- X-seq: zsh-workers 38996
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 3(b)/3] _man: Support _correct_word.
- Date: Thu,  4 Aug 2016 15:54:26 +0000
- In-reply-to: <1470326066-3241-1-git-send-email-danielsh@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1470326066-3241-1-git-send-email-danielsh@tarsus.local2>
Since compfiles is undocumented, avoid its use altogether, replacing it by
a construct that blackbox analysis suggests to be equivalent.
The compfiles call being removed effected the following change (when
completing «man -S 8:1 getc<TAB>»):
    BEFORE THE CALL:
        typeset -a pages=( /home/daniel/prefix/zsh/share/man/man1/
                           /usr/share/man/man8/
                           /usr/share/man/man1/ )
    AFTER THE CALL:
        typeset -a pages=( '/home/daniel/prefix/zsh/share/man/man1/getc*(8|1)*'
                           '/usr/share/man/man8/getc*(8|1)*'
                           '/usr/share/man/man1/getc*(8|1)*' )
This patch effects the same transformation (modulo doubling the final slash).
Any -M parameter will be passed to compadd.
---
 Completion/Unix/Command/_man | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index ffe53be..ae6ac38 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -103,7 +103,7 @@ _man() {
 }
 
 _man_pages() {
-  local matcher pages dummy sopt
+  local pages sopt
 
   # What files corresponding to manual pages can end in.
   local suf='.((?|<->*)(|.gz|.bz2|.Z|.lzma))'
@@ -121,17 +121,8 @@ _man_pages() {
     return $?
   fi
 
-  zparseopts -E M+:=matcher
-
-  if (( $#matcher )); then
-    matcher=( ${matcher:#-M} )
-    matcher="$matcher"
-  else
-    matcher=
-  fi
-
   pages=( ${(M)dirs:#*$sect_dirname/} )
-  compfiles -p pages '' '' "$matcher" '' dummy "*${sect}*"
+  pages=( ${^pages}/"*$sect${sect:+"*"}" );
   pages=( ${^~pages}(N:t) )
 
   (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author