On Wed, Dec 10, 2014 at 8:34 AM, Ed Avis <eda@waniasset.com> wrote:
>
> Of course this small change (and it is indeed a UI enhancement, not a bug)
> has stirred up opinions. The way I see it is that psql is trying to be
> friendly by guessing whether the user wants to run a pager or not. If it
> were written to be simple and correct (as is the right approach for core
> database code) then it would never do such guessing; the pager would have
> to be explicitly requested. If psql is going to guess on the user's
> behalf, it makes sense to do a good job.
>
psql does not guess whether the user wants a pager or tries to be friendly.
It uses a pager unless the user explicitly switches it off ( via \pset
pager off ). This is more or less clear from the docs. It uses $PAGER or a
'system dependent' default, but can be easily told to not invoke the pager
( which gives different results than using PAGER=cat ). And, at least
here, fails with an unfriendly message if I missconfigure it ( 'sh: 1:
none: not found' when PAGER=none ). Maybe pager=off as default is more
useful, maybe not defaulting $PAGER is, those I consider style questions,
but putting code for the case where a user runs it inside an special mode
of a concrete editor AND the user has not bothered to switch off the pager
or configure one which works in its environment ( pagers are tricky as you
have to read from the tty, but given [ perl -e 'open TTY,"</dev/tty"; while
(<>) { print ; (++$n %4) or scalar(<TTY>); }' ] works as a ( very bad )
pager inside emacs shell, getting or writing a decent one should not be too
difficult ) seems like a very bad idea to me. Even examining
termcap/terminfo to check the current ( dumb? ) capabilities seems a bad
idea, as pagers can work with really simple terminals. And, as I stated
before, I'm an emacs shell user, but I prefer to keep psql simpler.
And it does not guess, it follows orders. Examining INSIDE_EMACS and any
other things would be guessing ( correct or good guessing, but guessing ).
Francisco Olarte.