Skip to content

Commit 111b5eb

Browse files
committed
groff: Add site.tmac to fix man page coloring
This enables groff to correctly respond to the LESS_TERMCAP_* environment variables, allowing colorized man pages. Patch is taken from Arch Linux; see https://bugs.archlinux.org/task/33760.
1 parent 3c29fbe commit 111b5eb

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

pkgs/tools/text/groff/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ stdenv.mkDerivation rec {
5959
postInstall = ''
6060
rm $doc/share/doc/groff/examples/hdtbl/*color*ps
6161
find $doc/share/doc/groff/ -type f -print0 | xargs -0 sed -i -e 's/%%CreationDate: .*//'
62+
for f in 'man.local' 'mdoc.local'; do
63+
cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
64+
done
6265
'';
6366

6467
meta = with stdenv.lib; {

pkgs/tools/text/groff/site.tmac

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.
2+
.if n \{\
3+
. \" Character translations for non-keyboard
4+
. \" characters - to make them searchable
5+
. if '\*[.T]'utf8' \{\
6+
. char \- \N'45'
7+
. char - \N'45'
8+
. char ' \N'39'
9+
. char \' \N'39'
10+
. \}
11+
.
12+
. \" Shut off SGR by default (groff colors)
13+
. \" Require GROFF_SGR envvar defined to turn it on
14+
. if '\V[GROFF_SGR]'' \
15+
. output x X tty: sgr 0
16+
.\}

0 commit comments

Comments
 (0)