rc man/doc: Don't show groff warnings

Sometimes the implementation of `man` will display errors, e.g.

```
<standard input>:4808: warning [p 54, 13.2i]: can't break line
```

Those errors are harmless but are still reported on the debug buffer,
so we hide them by redirecting the standard error stream to /dev/null.
This commit is contained in:
Frank LENORMAND 2017-09-30 08:23:10 +03:00
parent 1e3c343773
commit 1cfee17a16
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@ def -hidden -params 1..2 doc-open %{
# This option is handled by the `man-db` implementation # This option is handled by the `man-db` implementation
export MANWIDTH=${kak_window_width} export MANWIDTH=${kak_window_width}
if man "$1" > "${manout}"; then if man "$1" > "${manout}" 2>/dev/null; then
readonly manout_noescape=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) readonly manout_noescape=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
sed -e $(printf 's/.\x8//g') -e 's,\x1B\[[0-9;]*[a-zA-Z],,g' "${manout}" > "${manout_noescape}" sed -e $(printf 's/.\x8//g') -e 's,\x1B\[[0-9;]*[a-zA-Z],,g' "${manout}" > "${manout_noescape}"

View File

@ -30,7 +30,7 @@ hook global WinSetOption filetype=(?!man).* %{
def -hidden -params 1..2 man-impl %{ %sh{ def -hidden -params 1..2 man-impl %{ %sh{
manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
MANWIDTH=${kak_window_width} man "$@" > $manout MANWIDTH=${kak_window_width} man "$@" > $manout 2>/dev/null
retval=$? retval=$?
col -b -x > ${colout} < ${manout} col -b -x > ${colout} < ${manout}
rm ${manout} rm ${manout}