diff options
| author | Jim Porter | 2021-10-28 18:44:39 +0200 |
|---|---|---|
| committer | Michael Albinus | 2021-10-28 18:44:39 +0200 |
| commit | 9c95a4fa55a4b6956a16dee9144a68db571d7e2c (patch) | |
| tree | 192f499f1430de17fa7ee4216414c46212ea4135 | |
| parent | 802e9b1b453506174c94f72c504fb4b83e85828e (diff) | |
| download | emacs-9c95a4fa55a4b6956a16dee9144a68db571d7e2c.tar.gz emacs-9c95a4fa55a4b6956a16dee9144a68db571d7e2c.zip | |
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.
| -rw-r--r-- | doc/emacs/misc.texi | 12 | ||||
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/comint.el | 13 |
3 files changed, 24 insertions, 9 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 5123a716dcb..f66b69cdd73 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -1497,14 +1497,20 @@ directory stack if they are not already on it | |||
| 1497 | underlying shell, of course. | 1497 | underlying shell, of course. |
| 1498 | 1498 | ||
| 1499 | @vindex comint-terminfo-terminal | 1499 | @vindex comint-terminfo-terminal |
| 1500 | @vindex system-uses-terminfo | ||
| 1500 | @vindex TERM@r{, environment variable, in sub-shell} | 1501 | @vindex TERM@r{, environment variable, in sub-shell} |
| 1501 | Comint mode sets the @env{TERM} environment variable to a safe default | 1502 | Comint mode sets the @env{TERM} environment variable to a safe default |
| 1502 | value, but this value disables some useful features. For example, | 1503 | value, but this value disables some useful features. For example, |
| 1503 | color is disabled in applications that use @env{TERM} to determine if | 1504 | color is disabled in applications that use @env{TERM} to determine if |
| 1504 | color is supported. Therefore, Emacs provides an option | 1505 | color is supported. Therefore, Emacs provides an option |
| 1505 | @code{comint-terminfo-terminal}, which you can set to a terminal that | 1506 | @code{comint-terminfo-terminal} to let you choose a terminal with more |
| 1506 | is present in your system's terminfo database, in order to take | 1507 | advanced features, as defined in your system's terminfo database. |
| 1507 | advantage of advanced features of that terminal. | 1508 | Emacs will use this option as the value for @env{TERM} so long as |
| 1509 | @code{system-uses-terminfo} is non-nil. | ||
| 1510 | |||
| 1511 | Both @code{comint-terminfo-terminal} and @code{system-uses-terminfo} | ||
| 1512 | can be declared as connection-local variables to adjust these options | ||
| 1513 | to match what a remote system expects (@pxref{Connection Variables}). | ||
| 1508 | 1514 | ||
| 1509 | @node Terminal emulator | 1515 | @node Terminal emulator |
| 1510 | @subsection Emacs Terminal Emulator | 1516 | @subsection Emacs Terminal Emulator |
| @@ -120,6 +120,14 @@ When non-nil, if the point is in a closing delimiter and the opening | |||
| 120 | delimiter is offscreen, shows some context around the opening | 120 | delimiter is offscreen, shows some context around the opening |
| 121 | delimiter in the echo area. | 121 | delimiter in the echo area. |
| 122 | 122 | ||
| 123 | ** Comint | ||
| 124 | |||
| 125 | +++ | ||
| 126 | *** 'comint-term-environment' is now aware of connection-local variables. | ||
| 127 | The user option 'comint-terminfo-terminal' and variable | ||
| 128 | 'system-uses-terminfo' can now be set as connection-local variables to | ||
| 129 | change the terminal used on a remote host. | ||
| 130 | |||
| 123 | 131 | ||
| 124 | * Changes in Specialized Modes and Packages in Emacs 29.1 | 132 | * Changes in Specialized Modes and Packages in Emacs 29.1 |
| 125 | 133 | ||
diff --git a/lisp/comint.el b/lisp/comint.el index e925b3a4b63..c114bdf758a 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -889,12 +889,13 @@ series of processes in the same Comint buffer. The hook | |||
| 889 | ;; and there is no way for us to define it here. | 889 | ;; and there is no way for us to define it here. |
| 890 | ;; Some programs that use terminfo get very confused | 890 | ;; Some programs that use terminfo get very confused |
| 891 | ;; if TERM is not a valid terminal type. | 891 | ;; if TERM is not a valid terminal type. |
| 892 | (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) | 892 | (with-connection-local-variables |
| 893 | (list (format "TERM=%s" comint-terminfo-terminal) | 893 | (if system-uses-terminfo |
| 894 | "TERMCAP=" | 894 | (list (format "TERM=%s" comint-terminfo-terminal) |
| 895 | (format "COLUMNS=%d" (window-width))) | 895 | "TERMCAP=" |
| 896 | (list "TERM=emacs" | 896 | (format "COLUMNS=%d" (window-width))) |
| 897 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))) | 897 | (list "TERM=emacs" |
| 898 | (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))))) | ||
| 898 | 899 | ||
| 899 | (defun comint-nonblank-p (str) | 900 | (defun comint-nonblank-p (str) |
| 900 | "Return non-nil if STR contains non-whitespace syntax." | 901 | "Return non-nil if STR contains non-whitespace syntax." |