Skip to content

Conversation

@silversquirl
Copy link
Contributor

The manpath binary is the preferred way to find the path for man pages with GNU man. This is relevant when PATH contains extra bin directories, but MANPATH is unset - manpath will find the corresponding share/man directories for each entry in PATH.

-shell-script-candidates %{
find /usr/share/man/ $(printf %s "${MANPATH}" |
sed 's/:/ /') -name '*.[1-8]*' |
: "${MANPATH:="$(manpath)"}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this breaks the case where MANPATH is set but contains an empty component (which should be substituted with the "system default path").

$ env | grep MANPATH
MANPATH=/home/johannes/.local/share/man:
$ manpath
manpath: warning: $MANPATH set, appending /etc/man_db.conf
/home/johannes/.local/share/man:/home/johannes/.local/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/lib/jvm/default/man

So I think we want to call manpath always,
or reimplement it by looking in $PATH

Either way, it looks like this patch would allow me to drop this explicitly-set $MANPATH which I just realized is already implied by $PATH (except in Kakoune's :man).

BTW, a completely different approach would be to use apropos ^ to compute these completions,
which should give the same results (it's shipped with mandoc man-db).
That's what fish shell uses; but it has gross workarounds for macOS.
We could try to get rid of those.

: "${MANPATH:=/usr/share/man}"
set -f
IFS=:
find $MANPATH -name '*.[1-8]*' |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manpath will find the corresponding share/man directories for each entry in PATH.

where is this documented?
I can see the PATH behavior mentioned in FreeBSD man
but not in man-db man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants