Ticket #629 (new enhancement)

Opened 14 years ago

Last modified 8 years ago

discuss should respect $PAGER

Reported by: broder Owned by:
Priority: trivial Milestone: The Distant Future
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

client/pager.c in discuss currently hard-codes using "more".

On Debian/Ubuntu?, at least, sensible-pager is a much more sensible pager than more, because it generally uses less.

We should make the pager a compile-time flag, or something, and set it to sensible-pager in our packaging.

Alternatively, I'd settle for just s/more/less/

Change History

comment:1 Changed 14 years ago by jdreed

Largely due to my horrific experiences with sensible-browser, I have no respect whatsoever for the sensible-foo utilities. Additionally, as I think we learned this week, even minute UI changes result in lots of anger.

I think a more reasonable and upstream-able change would be to make it honor $PAGER, and fallback to "more". OTOH, we're the upstream, so *shrug*.

comment:2 Changed 14 years ago by broder

The sensible-browser thing seems to be specifically a bug in either firefox or xlinks2, At this point, I hold us kind of responsible for being lame about getting it fixed.

sensible-pager is much more sensible. It first uses PAGER. It then falls back on pager, which is (correctly) managed by alternatives:

dr-wily:~ broder$ /usr/sbin/update-alternatives --display pager
pager - status is auto.
 link currently points to /usr/bin/less
/bin/more - priority 50
 slave pager.1.gz: /usr/share/man/man1/more.1.gz
/usr/bin/pg - priority 10
 slave pager.1.gz: /usr/share/man/man1/pg.1.gz
/usr/bin/less - priority 77
 slave pager.1.gz: /usr/share/man/man1/less.1.gz
/usr/bin/w3m - priority 25
 slave pager.1.gz: /usr/share/man/man1/w3m.1.gz
/usr/bin/most - priority 60
 slave pager.1.gz: /usr/share/man/man1/most.1.gz
Current `best' version is /usr/bin/less.

And finally falls back on "more" as a last option

comment:3 Changed 14 years ago by jdreed

The fact that w3m is in this list makes me sad. OTOH, "less" is depended on by ubuntu-minimal, so this is probably fine.

See also my comment about UI changes (specifically, the differing behavior between "more" and "less" when given less than one screenful of information.

comment:4 follow-up: ↓ 6 Changed 14 years ago by broder

You can make less match more's behavior by setting LESS=-F

comment:5 follow-up: ↓ 7 Changed 14 years ago by andersk

  • Summary changed from discuss should use sensible-pager on Debian/Ubuntu to discuss should respect $PAGER

Note that Debian Policy actually  requires that “every program that launches an editor or pager must use the EDITOR or PAGER environment variable to determine the editor or pager the user wishes to use. If these variables are not set, the programs /usr/bin/editor and /usr/bin/pager should be used, respectively.” It goes on to say that sensible-{editor,pager} should be used only as a compromise if the above is difficult to implement.

So, we should make Discuss respect $PAGER and fall back to a default set at configure time, which the Debian packaging will configure to /usr/bin/pager (while the “upstream” default default should remain more, for portability).

comment:6 in reply to: ↑ 4 Changed 14 years ago by andersk

Replying to broder:

You can make less match more's behavior by setting LESS=-F

(Note that on most modern terminals,  -FX is needed. This has other side effects, such as disabling mouse wheel support, but if you’re coming from ‘more’ you presumably didn’t care about that.)

comment:7 in reply to: ↑ 5 Changed 14 years ago by broder

Replying to andersk:

So, we should make Discuss respect $PAGER and fall back to a default set at configure time, which the Debian packaging will configure to /usr/bin/pager (while the “upstream” default default should remain more, for portability).

Hmm...do we need to do the moral equivalent of shlex.split(os.environ['PAGER']) before exec'ing it? It looks like sensible-pager certainly does:

dr-wily:~ broder$ head -n 3 /usr/bin/sensible-pager 
#!/bin/sh

${PAGER:-pager} "$@"

I'm not sure how we can split arguments like that, short of using system()

comment:8 Changed 14 years ago by broder

On the other hand, discuss doesn't pass any arguments to "more" (or "pager", or whatever) - it just spews stuff to the pager's stdin - so maybe it wouldn't be unreasonable to use system().

Note: See TracTickets for help on using tickets.