unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: 51426@debbugs.gnu.org
Subject: bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?
Date: Tue, 26 Oct 2021 15:54:03 -0700	[thread overview]
Message-ID: <69264ece-bb7f-4db1-f461-dacd33db2402@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

`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.

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...

[1] https://packages.debian.org/buster/all/ncurses-term/filelist

[-- Attachment #2: 0001-lisp-comint.el-comint-term-environment-Make-it-conne.patch --]
[-- Type: text/plain, Size: 1383 bytes --]

From f2d247b5201da01a19b87e3b17a90891a19c4c60 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Tue, 26 Oct 2021 15:18:43 -0700
Subject: [PATCH] * lisp/comint.el (comint-term-environment): Make it
 connection-aware.

---
 lisp/comint.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

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)
+       (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))))))
 
 (defun comint-nonblank-p (str)
   "Return non-nil if STR contains non-whitespace syntax."
-- 
2.25.1


             reply	other threads:[~2021-10-26 22:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 22:54 Jim Porter [this message]
2021-10-27  8:20 ` bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware? Michael Albinus
2021-10-28  0:45   ` Jim Porter
2021-10-28  8:02     ` Michael Albinus
2021-10-28 15:49       ` Jim Porter
2021-10-28 16:48         ` Michael Albinus
2021-10-29  5:26           ` Jim Porter
2021-10-29  8:21             ` Michael Albinus
2021-10-29 16:39               ` Jim Porter
2021-10-30 15:43                 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69264ece-bb7f-4db1-f461-dacd33db2402@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=51426@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).