On Sat, Aug 22, 2015 at 04:15:10PM -0400, Rafael Kitover wrote: > When man invokes /usr/bin/pager to view a man page, it passes the less > -s option to squeeze blank lines. > > It should probably not do that, because /usr/bin/pager may not be less > and may not support the -s option. > > Would you like a patch to perhaps check if /usr/bin/pager is less, or > PAGER is less and only then pass the -s option? Or some other solution?
Patches always welcome, of course, but I think this needs a little more work. If we only cared about less, the simplest option would be to just move it into the LESS environment variable we set. However, all of more, less, and most (the three I tried off the top of my head) support -s, and groff does emit multiple blank lines sometimes: you can see it for instance above tables if you run "MANPAGER=pager man man". It would be a shame to make things worse for pagers that aren't less but that do support -s. By the way, while I take your general point, do you have a specific example of one that doesn't? I think that the best approach would be to interpose a function in the output pipeline that squeezes consecutive blank lines in a pager-independent way. To do that, you'd need to write a function that reads from stdin a chunk at a time, does the necessary transformation, and writes to stdout (see e.g. decompress_zlib for a similar example that decompresses its input), and then use pipecmd_new_function and pipeline_command near the start of make_display_command to arrange for it to be called. Would you like to attempt this? I'd be happy to review patches. If it's too difficult or you don't have time, I'd of course be happy to implement it, but since you seemed interested in making an attempt I don't want to take the opportunity away from you. Thanks, -- Colin Watson [cjwat...@debian.org]