Re: BUG #11986: psql uses pager inside Emacs shell buffer (not a terminal)

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Ed Avis <eda(at)waniasset(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #11986: psql uses pager inside Emacs shell buffer (not a terminal)
Date: 2014-12-10 17:17:32
Message-ID: CA+bJJbyLGopy=+EzM2j5UxBQqVbX7ynxf=ZdcpCuzr1Fw0kfmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Dec 10, 2014 at 8:34 AM, Ed Avis <eda(at)waniasset(dot)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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ed Avis 2014-12-10 17:26:23 Re: BUG #11986: psql uses pager inside Emacs shell buffer (not a terminal)
Previous Message Andrew Sackville-West 2014-12-10 16:29:55 Re: regression, deadlock in high frequency single-row UPDATE