From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware? Date: Wed, 27 Oct 2021 10:20:27 +0200 Message-ID: <87cznqev5g.fsf@gmx.de> References: <69264ece-bb7f-4db1-f461-dacd33db2402@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32270"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 51426@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 27 10:21:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfeBV-00089W-Tq for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Oct 2021 10:21:22 +0200 Original-Received: from localhost ([::1]:53188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfeBU-0006si-FU for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Oct 2021 04:21:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfeBD-0006sW-Qs for bug-gnu-emacs@gnu.org; Wed, 27 Oct 2021 04:21:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfeBC-0002iF-Oz for bug-gnu-emacs@gnu.org; Wed, 27 Oct 2021 04:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfeBC-0002PD-CX for bug-gnu-emacs@gnu.org; Wed, 27 Oct 2021 04:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Oct 2021 08:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51426-submit@debbugs.gnu.org id=B51426.16353228379177 (code B ref 51426); Wed, 27 Oct 2021 08:21:02 +0000 Original-Received: (at 51426) by debbugs.gnu.org; 27 Oct 2021 08:20:37 +0000 Original-Received: from localhost ([127.0.0.1]:48371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfeAn-0002Nx-Ct for submit@debbugs.gnu.org; Wed, 27 Oct 2021 04:20:37 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:41073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfeAl-0002Ng-GP for 51426@debbugs.gnu.org; Wed, 27 Oct 2021 04:20:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1635322829; bh=nOFs+nV2nBNtkcbwW8H3umcINE6I8wv61jo4//6/I24=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=BJV618eQbTvGhWQOCDu02QP/D3vJlbk/coQ6Pjm/xmXALVKpWDmCVFeFxhfC5jZS7 X2p8Oy7GeaUr/I6WmuKKrOamS5r3Pz6ofw9WMAgD3wXniMwSR4Lik/LKG85lPvWlFh v1ZrquenPIJoGCriVM+2aPfO2IpGIHL9Cbo5uxt0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.91.242.69]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MvbFs-1mz6So3Ddu-00sbLj; Wed, 27 Oct 2021 10:20:28 +0200 In-Reply-To: <69264ece-bb7f-4db1-f461-dacd33db2402@gmail.com> (Jim Porter's message of "Tue, 26 Oct 2021 15:54:03 -0700") X-Provags-ID: V03:K1:QtS5jlTTxiK0urue2js9QSyb91BxK7UhTERyB6MjHa3uzAI5z64 D7YexjOgYEfILY4buB65CFPf5swEfwWo9HDHltKIWer4Kvb6YvtUM5z9caAtWf7Ixnb0QPy VD+PfwYi9TZ7EfCIJYRqYzT+UaGX+afQkFApkT/G0SzmVeahqDnNFdZf7u03CNpgvsIxVWS GF90Dyp2b4q3ihXy088BA== X-UI-Out-Filterresults: notjunk:1;V03:K0:9u2ZLuXpv8A=:JmucswqljjEI6rxF4nVQaW 8aKWmEom/N9OBl/HR67+1yQzyvlFNBr/wi1LQLCuejMqdgEu9oiTU7ey4opyczu9N6mNYTubQ B5FNNK2DJA9X9aighJ2Seu0gyLmaSiwsjlIebUx2/0NaSi1kDPoLw5x13Hft/eNUTXt0rlx9/ v4KBdNqM8laTucRJIbnAUITLrQDV4cbGQoRtw3Lf9w+eYLC5y7LLDqIumKJSyeJgKeaxQZB9W Kl6NuwCixf72zeJJJVyZ9zYPwiG3NBWkG784NPLHAC3MYAtlkZgg55vyAcA5m7tGE+fZEvczf aN+G96LhzWV0UxhDoy6SaxopHA7CWP3pOGY09NWCXq8tizldoYy4lO/PL6jL3DQCKSMfvbYn4 G2PpIvjxJtOZs5X1pdkq5VJ7jI35az4nMvvshhyCs4XCQt+nFaHygJXgoJgLt/oHFejSLrgXs mtiqAUWPxOWx1GAD+rplLOdgTww2pKpoIpjIFMuIpR3QIKL+EDDr91D+XBywfeR/51j9vND5b THGuhZHsra03WLhOTzmDdSCANuQvX+yfKEMRmT8tJYCnyQcZK2F/1XyK5nzFwmjWf9F4Z5sjw HUzzoxqeEqtwno3uUqpkq4rwHrf5TlQsu0SDmK0zCUvcuNXw7CLW4xKlagDt8vMhHBdFF7CCi c4Ctp5r80kWpa/p/MxPMmYJJCi4uAgQjbzgAjMTs2Qtlof0dx9bzQzqBxqXBKrXxByuvELWPY tNvGsq5K1zr3cec2j3XaPZ9mVq3tHJhF+OXoQLMdrwOeqxNn9YHcDeCs9TlYw2jWIx433R2S X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218421 Archived-At: Jim Porter writes: Hi Jim, > `comint-term-environment' consults `system-uses-terminfo' to determine > how to set environment variables to indicate comint's terminal > capabilities. However, `system-uses-terminfo' describes whether the > host system running Emacs uses terminfo, not whether the remote system > uses it. Similarly for `comint-terminfo-terminal'. > > If `comint-term-environment' were aware of connection-local variables, > it would be possible to create a connection-local profile to configure > this for remote hosts, e.g.: > > (connection-local-set-profile-variables > 'remote-terminfo > '((system-uses-terminfo . t) > (comint-terminfo-terminal . "dumb-emacs-ansi"))) > > (connection-local-set-profiles > '(:application tramp :machine "foo") > 'remote-terminfo)) > > (Note: "dumb-emacs-ansi" comes from the ncurses-term package[1] in > Debian, and should be a good value to represent comint's > capabilities.) > > This lets the user pass a terminfo-friendly value for TERM to the > remote system, even if the local system doesn't use terminfo. Then > programs on the remote system can consult terminfo to their hearts' > content. Looks good to me. However, this technique must be documented anywhere. Likely in the Emacs manual, node "Shell Options" (file doc/emacs/misc.texi). > I've attached a patch that does this, assuming the reasoning above > makes sense. Perhaps it also warrants an entry in NEWS? I wasn't > sure... Yes, it should be said in etc/NEWS. > diff --git a/lisp/comint.el b/lisp/comint.el > index e925b3a4b6..04e39edc42 100644 > --- a/lisp/comint.el > +++ b/lisp/comint.el > @@ -889,12 +889,13 @@ comint-term-environment > ;; and there is no way for us to define it here. > ;; Some programs that use terminfo get very confused > ;; if TERM is not a valid terminal type. > - (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) > - (list (format "TERM=%s" comint-terminfo-terminal) > - "TERMCAP=" > - (format "COLUMNS=%d" (window-width))) > - (list "TERM=emacs" > - (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))) > + (with-connection-local-variables > + (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) According to git log, the variable system-uses-terminfo exists since --8<---------------cut here---------------start------------->8--- commit 07c57952d8364663eb2abd979457cc880b7fd855 Author: Karl Heuer Date: Fri Apr 8 06:59:55 1994 +0000 (system_uses_terminfo): New variable. (syms_of_term): New function, to initialize it. --8<---------------cut here---------------end--------------->8--- I guess it is save to get rid of "(and (boundp 'system-uses-terminfo)". Best regards, Michael.