[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connecti
From: |
Michael Albinus |
Subject: |
bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware? |
Date: |
Wed, 27 Oct 2021 10:20:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Jim Porter <jporterbugs@gmail.com> 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 <kwzh@gnu.org>
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.
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Jim Porter, 2021/10/26
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?,
Michael Albinus <=
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Jim Porter, 2021/10/27
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Michael Albinus, 2021/10/28
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Jim Porter, 2021/10/28
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Michael Albinus, 2021/10/28
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Jim Porter, 2021/10/29
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Michael Albinus, 2021/10/29
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Jim Porter, 2021/10/29
- bug#51426: 29.0.50; [PATCH] Should 'comint-term-environment' be connection-aware?, Michael Albinus, 2021/10/30