about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-10 11:00:05 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-10 11:00:05 +0000
commit5659f442c09bf3e94a60887b998473af02590477 (patch)
tree1180270207278bd62e4061dc44533780eaa45c84
parent324e26d8ceb08ea907c686265f2b51bbc8232cff (diff)
downloadzsh-5659f442c09bf3e94a60887b998473af02590477.tar.gz
zsh-5659f442c09bf3e94a60887b998473af02590477.tar.xz
zsh-5659f442c09bf3e94a60887b998473af02590477.zip
allow manual pages to be shown separated by section with new separate-sections style (16426)
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/_man24
-rw-r--r--Completion/Zsh/Command/_zstyle1
-rw-r--r--Doc/Zsh/compsys.yo9
4 files changed, 39 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b7bf30788..b75e396cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-10  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 16426: Completion/Unix/Command/_man,
+	Completion/Zsh/Command/_zstyle, Doc/Zsh/compsys.yo: allow
+	manual pages to be shown separated by section with new
+	separate-sections style
+
 2002-01-10  Peter Stephenson  <pws@csr.com>
 
 	* 16423: Src/params.c: Don't let convfloat output a number
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 3da15f9ba..44634369c 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -40,8 +40,28 @@ _man() {
     dirs=( $^manpath/(sman|man|cat)*/ )
     awk='{print $1}'
   fi
+  if zstyle -t ":completion:${curcontext}:manuals" separate-sections; then
+    typeset -U sects
+    local ret=1
 
-  _wanted manuals expl 'manual page' _man_pages
+    sects=( ${(o)${dirs##*(man|cat)}%/} )
+
+    (( $#sects )) || return 1
+
+    _tags manuals.${^sects}
+    while _tags; do
+      for sect in $sects; do
+        _requested manuals.$sect expl "manual page, section $sect" _man_pages &&
+            ret=0
+      done
+      (( ret )) || return 0
+    done
+
+    return 1
+  else
+    sect=
+    _wanted manuals expl 'manual page' _man_pages
+  fi
 }
 
 _man_pages() {
@@ -56,7 +76,7 @@ _man_pages() {
     matcher=
   fi
 
-  pages=( $dirs )
+  pages=( ${(M)dirs:#*$sect/} )
   compfiles -p pages '' '' "$matcher" '' dummy '*'
   pages=( ${^~pages}(N:t:r) )
 
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index ffd3c6dd4..48a39deed 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -100,6 +100,7 @@ styles=(
   remove-all-dups	 c:bool
   select-prompt          c:
   select-scroll          c:
+  separate-sections      c:bool
   single-ignored         c:single-ignored
   sort			 c:bool
   special-dirs		 c:sdirs
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 0eaf4f8c4..d7bfaa824 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1971,6 +1971,15 @@ negative number to scroll by the number of lines of the screen minus
 that number (or plus the number, since it is negative).  The default is to
 scroll by single lines.
 )
+kindex(separate-sections, completion style)
+item(tt(separate-sections))(
+This style is used with the tt(manuals) tag when completing names of
+manual pages.  If it is `true', entries for different sections are
+added separately using tag names of the form `tt(manual.)var(X)',
+where var(X) is the section number.  This means that it is possible to
+make pages from different sections be listed separately by setting the
+tt(group-name) style.  The default for this style is `false'.
+)
 kindex(single-ignored, completion style)
 item(tt(single-ignored))(
 This is used by the tt(_ignored) completer.  It specifies what