emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9c95a4f: Make comint-term-environment connection-aware (bug#51426


From: Michael Albinus
Subject: master 9c95a4f: Make comint-term-environment connection-aware (bug#51426)
Date: Thu, 28 Oct 2021 12:44:47 -0400 (EDT)

branch: master
commit 9c95a4fa55a4b6956a16dee9144a68db571d7e2c
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Make comint-term-environment connection-aware (bug#51426)
    
    * lisp/comint.el (comint-term-environment): Make it connection-aware.
    
    * doc/emacs/misc.texi (Shell Options): Document the above change, and
    explain how this interacts with 'system-uses-terminfo'.
    
    * etc/NEWS: Announce the above change.
---
 doc/emacs/misc.texi | 12 +++++++++---
 etc/NEWS            |  8 ++++++++
 lisp/comint.el      | 13 +++++++------
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 5123a71..f66b69c 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1497,14 +1497,20 @@ directory stack if they are not already on it
 underlying shell, of course.
 
 @vindex comint-terminfo-terminal
+@vindex system-uses-terminfo
 @vindex TERM@r{, environment variable, in sub-shell}
 Comint mode sets the @env{TERM} environment variable to a safe default
 value, but this value disables some useful features.  For example,
 color is disabled in applications that use @env{TERM} to determine if
 color is supported.  Therefore, Emacs provides an option
-@code{comint-terminfo-terminal}, which you can set to a terminal that
-is present in your system's terminfo database, in order to take
-advantage of advanced features of that terminal.
+@code{comint-terminfo-terminal} to let you choose a terminal with more
+advanced features, as defined in your system's terminfo database.
+Emacs will use this option as the value for @env{TERM} so long as
+@code{system-uses-terminfo} is non-nil.
+
+Both @code{comint-terminfo-terminal} and @code{system-uses-terminfo}
+can be declared as connection-local variables to adjust these options
+to match what a remote system expects (@pxref{Connection Variables}).
 
 @node Terminal emulator
 @subsection Emacs Terminal Emulator
diff --git a/etc/NEWS b/etc/NEWS
index 4f48cfb..f006fa5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -120,6 +120,14 @@ When non-nil, if the point is in a closing delimiter and 
the opening
 delimiter is offscreen, shows some context around the opening
 delimiter in the echo area.
 
+** Comint
+
++++
+*** 'comint-term-environment' is now aware of connection-local variables.
+The user option 'comint-terminfo-terminal' and variable
+'system-uses-terminfo' can now be set as connection-local variables to
+change the terminal used on a remote host.
+
 
 * Changes in Specialized Modes and Packages in Emacs 29.1
 
diff --git a/lisp/comint.el b/lisp/comint.el
index e925b3a..c114bdf 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -889,12 +889,13 @@ series of processes in the same Comint buffer.  The hook
   ;; 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 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]