* [patch] _man: Support directories with suffixes
@ 2016-05-19 5:07 Matthew Martin
2016-05-19 21:14 ` Daniel Shahaf
2016-07-31 16:23 ` Daniel Shahaf
0 siblings, 2 replies; 3+ messages in thread
From: Matthew Martin @ 2016-05-19 5:07 UTC (permalink / raw)
To: zsh-workers
896f43c broke completion for man 3p <tab> on OpenBSD because those man
pages are in /usr/share/man/man3p.
I couldn't figure out what was the purpose for using $~sect, so I just
dropped the tilde.
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 0534db7..9aec833 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -52,7 +52,7 @@ _man() {
fi
if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
- dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ )
+ dirs=( $^_manpath/(sman|man|cat)($sect|${sect%%[^0-9]#})/ )
awk="\$2 == \"$sect\" {print \$1}"
else
dirs=( $^_manpath/(sman|man|cat)*/ )
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] _man: Support directories with suffixes
2016-05-19 5:07 [patch] _man: Support directories with suffixes Matthew Martin
@ 2016-05-19 21:14 ` Daniel Shahaf
2016-07-31 16:23 ` Daniel Shahaf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-05-19 21:14 UTC (permalink / raw)
To: zsh-workers
Matthew Martin wrote on Thu, May 19, 2016 at 00:07:25 -0500:
> 896f43c broke completion for man 3p <tab> on OpenBSD because those man
> pages are in /usr/share/man/man3p.
>
> I couldn't figure out what was the purpose for using $~sect, so I just
> dropped the tilde.
>
Sorry about that. Dropping the tilde would be fine with me (I didn't
add it, I'm not sure what it's for, and my use-case works without it).
Tangentially related: I noticed that _man doesn't handle corrections —
e.g., «man 3 getwpnam<_correct_word>» has no matches, even though «man
3 getpwna<TAB>» completes «getpwnam» — but haven't investigated.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] _man: Support directories with suffixes
2016-05-19 5:07 [patch] _man: Support directories with suffixes Matthew Martin
2016-05-19 21:14 ` Daniel Shahaf
@ 2016-07-31 16:23 ` Daniel Shahaf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-07-31 16:23 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]
This hasn't been committed.
Matthew Martin wrote on Thu, May 19, 2016 at 00:07:25 -0500:
> I couldn't figure out what was the purpose for using $~sect, so I just
> dropped the tilde.
I found it:
-S list, -s list, --sections=list
List is a colon- or comma-separated list of `order specific'
manual sections to search. This option overrides the $MANSECT
environment variable. (The -s spelling is for compatibility
with System V.)
That's on linux; the 'else if' branch just above the diff context
implements that syntax.
896f43c broke that syntax too: the new %% causes a pattern syntax
error. Your patch doesn't fix this problem (since it keeps the %%).
I'm therefore attaching an alternative patch which I believe will fix
both that issue and the issue you originally saw:
> 896f43c broke completion for man 3p <tab> on OpenBSD because those man
> pages are in /usr/share/man/man3p.
Testing on various OSes would be appreciated.
Thanks,
Daniel
>
>
> diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
> index 0534db7..9aec833 100644
> --- a/Completion/Unix/Command/_man
> +++ b/Completion/Unix/Command/_man
> @@ -52,7 +52,7 @@ _man() {
> fi
>
> if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
> - dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ )
> + dirs=( $^_manpath/(sman|man|cat)($sect|${sect%%[^0-9]#})/ )
> awk="\$2 == \"$sect\" {print \$1}"
> else
> dirs=( $^_manpath/(sman|man|cat)*/ )
>
[-- Attachment #2: 0001-_man-Followup-to-37634-unbreak-OpenBSD-man-3p-and-Li.patch --]
[-- Type: text/x-diff, Size: 1469 bytes --]
>From 6d635d29d6378c4b320a5c1561f5a2d0630e1932 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@daniel.shahaf.name>
Date: Sun, 31 Jul 2016 12:36:55 +0000
Subject: [PATCH] _man: Followup to 37634: unbreak OpenBSD 'man 3p' and Linux
$MANSECT.
The breakage was reported in 38516.
---
Completion/Unix/Command/_man | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 5ace087..0b427d2 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -44,15 +44,21 @@ _man() {
if [[ $OSTYPE = solaris* ]]; then
sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]}
elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
- if [[ $sect != ${sect::="${sect//:/|}"} ]]; then
- sect="($sect)"
- fi
+ sect="${sect//:/|}"
+ sect="${sect//,/|}"
elif (( CURRENT > 2 )); then
sect=$words[2]
fi
- if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
- dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ )
+ if [[ $sect = (<->*|1M|l|n) || $sect = *\|* ]]; then
+ () {
+ local -a sects=( ${(s.|.)sect} )
+ if [[ $sect != (l|n) ]]; then
+ sects=( ${sects%%[^0-9]#} )
+ fi
+ dirs=( $^_manpath/(sman|man|cat)${^sects}*/ )
+ }
+ if [[ $sect == *\|* ]]; then sect="($sect)"; fi
awk="\$2 == \"$sect\" {print \$1}"
else
dirs=( $^_manpath/(sman|man|cat)*/ )
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-31 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 5:07 [patch] _man: Support directories with suffixes Matthew Martin
2016-05-19 21:14 ` Daniel Shahaf
2016-07-31 16:23 ` Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).