Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XyRKR-0000HH-D7 for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Dec 2014 20:24:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XyRKQ-0000oj-Sg for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Dec 2014 20:24:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XyRKP-0000ms-K9 for pgsql-bugs@postgresql.org; Tue, 09 Dec 2014 20:24:13 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XyRKK-0008GW-Mu for pgsql-bugs@postgresql.org; Tue, 09 Dec 2014 20:24:12 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1XyRKI-0000Pi-74; Tue, 09 Dec 2014 15:24:06 -0500 Date: Tue, 9 Dec 2014 15:24:06 -0500 From: Bruce Momjian To: Ed Avis Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11986: psql uses pager inside Emacs shell buffer (not a terminal) Message-ID: <20141209202406.GC24487@momjian.us> References: <20141117093434.2479.18410@wrigleys.postgresql.org> <20141203004050.GA25084@momjian.us> <26947.1417573493@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Mon, Dec 8, 2014 at 11:39:12AM +0000, Ed Avis wrote: > Tom Lane sss.pgh.pa.us> writes: > > >A quick check here shows a couple of different possibilities in the > >environment seen in a shell buffer: > > > >EMACS=t > >INSIDE_EMACS=23.1.1,comint > > Apparently EMACS=t is deprecated and INSIDE_EMACS is the one to use. > However, Emacs being Emacs, it has more than one way to run interactive > subprocesses. This bug report was about 'shell' mode, where a text editing > buffer provides a simple dumb terminal without cursor movement escape > sequences (and sets TERM=dumb). But there is also 'term', providing a > reasonably good terminal emulator inside Emacs. Inside that, a pager does > work (even sophisticated ones such as 'less') and it makes sense to use a > pager since you don't have a scrollable text buffer with all output, but > just a fixed-size terminal window. > > 'term' mode sets the environment variables to something like > > TERM=eterm-color > INSIDE_EMACS=24.4.1,term:0.96 > > So if INSIDE_EMACS is to be used (rather than checking for TERM=dumb) then > perhaps it should look for the 'comint' string. > > I appreciate the concern that this could open a Pandora's box of special > case checks for all sorts of terminal types, but this is only the psql > interactive shell we are talking about here, not the core database code. > And all that is being controlled is the relatively minor choice of whether > to run a pager program, not anything that affects database operations. > psql already contains lots of features which exist to make interactive use > more comfortable even at the expense of some complexity. Based on your report, I think checking for INSIDE_EMACS being set _and_ TERM=dumb would be the best bet. Do you want me to write a patch for you to test? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs