all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
@ 2024-05-01  6:40 Lin Sun
  2024-05-01 12:15 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Lin Sun @ 2024-05-01  6:40 UTC (permalink / raw)
  To: 70691

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

Hi,

Since emacs-29 the Eshell has been enhanced for the ansi-color a lot.
And the function `eshell-exec-visual` can support the executables with
colors, eg VIM, tmux...
I have tested the "/bin/ls --color=tty", "/bin/grep --color=tty" ...
and other executables in Eshell with "export TERM=eshell-color", they
all work great.

So we can safely export eshell's "TERM" with `eshell-term-name` to
support executables with colors.
I attached the patch, please help review it. Thanks.

[-- Attachment #2: 0001-Eshell-s-TERM-env-varible-use-eshell-term-name-as-de.patch --]
[-- Type: text/x-patch, Size: 2228 bytes --]

From 5a43430e88e414a798923d882eff7c3b7cb86c1c Mon Sep 17 00:00:00 2001
From: Lin Sun <sunlin7@hotmail.com>
Date: Wed, 1 May 2024 06:55:23 +0000
Subject: [PATCH] Eshell's TERM env varible use eshell-term-name as default

* lisp/eshell/esh-var.el (eshell-variable-aliases-list):
  Initialize the TERM environment variable with eshell-term-name.
* doc/misc/eshell.texi: Document for TERM environment variable.
* etc/NEWS: Add entry in NEWS file.
---
 doc/misc/eshell.texi   | 5 +++++
 etc/NEWS               | 4 ++++
 lisp/eshell/esh-var.el | 1 +
 3 files changed, 10 insertions(+)

diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 30c85da795..07611c49ef 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -1456,6 +1456,11 @@ Variables
 @code{comint-pager} if non-@code{nil}; otherwise, it uses the value of
 @code{$PAGER} from the @code{process-environment}.
 
+@vindex $TERM
+@item $TERM
+This variable indicates the terminal type of the eshell.  Its default
+value is @code{eshell-term-name}.
+
 @end table
 
 @xref{Aliases}, for the built-in variables @samp{$*}, @samp{$1},
diff --git a/etc/NEWS b/etc/NEWS
index 4b0106fcb0..5ebc5172f6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -864,6 +864,10 @@ command passed as arguments to 'env'.  If you pass any initial
 arguments of the form 'VAR=VALUE', 'env' will first set 'VAR' to
 'VALUE' before running the command.
 
++++
+*** Eshell's 'TERM' env var uses 'eshell-term-name' as default.
+The eshell's 'TERM' environment variable uses 'eshell-term-name' as default.
+
 ---
 *** Eshell's 'umask' command now supports setting the mask symbolically.
 Now, you can pass an argument like "u+w,o-r" to Eshell's 'umask'
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 02b5c78562..8dd8a84da8 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -161,6 +161,7 @@ eshell-variable-aliases-list
   `(;; for eshell.el
     ("COLUMNS" ,(lambda () (window-body-width nil 'remap)) t t)
     ("LINES" ,(lambda () (window-body-height nil 'remap)) t t)
+    ("TERM" eshell-term-name t)
     ("INSIDE_EMACS" eshell-inside-emacs t)
     ("PAGER" (,(lambda () (or comint-pager (getenv "PAGER")))
               . ,(lambda (_ value)
-- 
2.20.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01  6:40 bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default Lin Sun
@ 2024-05-01 12:15 ` Eli Zaretskii
  2024-05-01 15:51   ` Lin Sun
  2024-05-01 18:19   ` Jim Porter
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-05-01 12:15 UTC (permalink / raw)
  To: Lin Sun, Jim Porter; +Cc: 70691

> From: Lin Sun <sunlin7.mail@gmail.com>
> Date: Wed, 1 May 2024 06:40:25 +0000
> 
> Since emacs-29 the Eshell has been enhanced for the ansi-color a lot.
> And the function `eshell-exec-visual` can support the executables with
> colors, eg VIM, tmux...
> I have tested the "/bin/ls --color=tty", "/bin/grep --color=tty" ...
> and other executables in Eshell with "export TERM=eshell-color", they
> all work great.
> 
> So we can safely export eshell's "TERM" with `eshell-term-name` to
> support executables with colors.
> I attached the patch, please help review it. Thanks.

Thanks.

The fact that we can safely do that does not yet mean we _should_ do
it.  In my book, setting TERM is a user preference, more or less.
IOW, this is a change in the default behavior.

Jim, WDYT?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01 12:15 ` Eli Zaretskii
@ 2024-05-01 15:51   ` Lin Sun
  2024-05-01 18:19   ` Jim Porter
  1 sibling, 0 replies; 7+ messages in thread
From: Lin Sun @ 2024-05-01 15:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70691, Jim Porter

On Wed, May 1, 2024 at 12:15 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Lin Sun <sunlin7.mail@gmail.com>
> > Date: Wed, 1 May 2024 06:40:25 +0000
> >
> > Since emacs-29 the Eshell has been enhanced for the ansi-color a lot.
> > And the function `eshell-exec-visual` can support the executables with
> > colors, eg VIM, tmux...
> > I have tested the "/bin/ls --color=tty", "/bin/grep --color=tty" ...
> > and other executables in Eshell with "export TERM=eshell-color", they
> > all work great.
> >
> > So we can safely export eshell's "TERM" with `eshell-term-name` to
> > support executables with colors.
> > I attached the patch, please help review it. Thanks.
>
> Thanks.
>
> The fact that we can safely do that does not yet mean we _should_ do
> it.  In my book, setting TERM is a user preference, more or less.
> IOW, this is a change in the default behavior.
>
> Jim, WDYT?
The patch tries to uniform the behavior of "eshell" and "eshell-exec-visual".
When I tried the eshell visual commands, I noticed its experience is
better than eshell, and I figured out the eshell exec visual gives
TERM with "eshell-term-name", but eshell didn't do that.
And this patch will not affect the users who customized their TERM
environment in eshell profile or eshell hook functions.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01 12:15 ` Eli Zaretskii
  2024-05-01 15:51   ` Lin Sun
@ 2024-05-01 18:19   ` Jim Porter
  2024-05-01 19:37     ` Lin Sun
  1 sibling, 1 reply; 7+ messages in thread
From: Jim Porter @ 2024-05-01 18:19 UTC (permalink / raw)
  To: Eli Zaretskii, Lin Sun; +Cc: 70691

On 5/1/2024 5:15 AM, Eli Zaretskii wrote:
>> From: Lin Sun <sunlin7.mail@gmail.com>
>> Date: Wed, 1 May 2024 06:40:25 +0000
>>
>> Since emacs-29 the Eshell has been enhanced for the ansi-color a lot.
[snip]
>>
>> So we can safely export eshell's "TERM" with `eshell-term-name` to
>> support executables with colors.
>> I attached the patch, please help review it. Thanks.
> 
> The fact that we can safely do that does not yet mean we _should_ do
> it.  In my book, setting TERM is a user preference, more or less.
> IOW, this is a change in the default behavior.
> 
> Jim, WDYT?

Unfortunately, I don't think this is the right way to do things (or else 
I'm just not understanding some part of it). The docstring for 
'eshell-term-name' says, "Name to use for the TERM variable when running 
visual commands," and its value defaults to 'term-term-name'. For visual 
commands (which use term.el), the terminal can do a lot more than just 
setting colors, such as moving the cursor around. "Normal", non-visual 
Eshell can't do that, so I think using the same setting for $TERM would 
be wrong.

We could make Eshell set $TERM to "dumb-emacs-ansi", which should have 
the correct terminal settings. I believe that terminfo has been 
upstreamed into ncurses.

However, I think if you want colors, it's best to change 
'comint-terminfo-terminal' instead to "dumb-emacs-ansi" (and then Eshell 
will use that setting automatically). I *don't* think we should change 
'comint-terminfo-terminal' by default though; that would be pretty 
invasive. Maybe we could use the Customize interface to make selecting 
"dumb-emacs-ansi" a matter of just checking a box, instead of typing it 
out by hand?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01 18:19   ` Jim Porter
@ 2024-05-01 19:37     ` Lin Sun
  2024-05-01 19:49       ` Lin Sun
  2024-05-02  6:07       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Lin Sun @ 2024-05-01 19:37 UTC (permalink / raw)
  To: Jim Porter; +Cc: 70691, Eli Zaretskii

On Wed, May 1, 2024 at 6:19 PM Jim Porter <jporterbugs@gmail.com> wrote:
>
> On 5/1/2024 5:15 AM, Eli Zaretskii wrote:
> >> From: Lin Sun <sunlin7.mail@gmail.com>
> >> Date: Wed, 1 May 2024 06:40:25 +0000
> >>
> >> Since emacs-29 the Eshell has been enhanced for the ansi-color a lot.
> [snip]
> >>
> >> So we can safely export eshell's "TERM" with `eshell-term-name` to
> >> support executables with colors.
> >> I attached the patch, please help review it. Thanks.
> >
> > The fact that we can safely do that does not yet mean we _should_ do
> > it.  In my book, setting TERM is a user preference, more or less.
> > IOW, this is a change in the default behavior.
> >
> > Jim, WDYT?
>
> Unfortunately, I don't think this is the right way to do things (or else
> I'm just not understanding some part of it). The docstring for
> 'eshell-term-name' says, "Name to use for the TERM variable when running
> visual commands," and its value defaults to 'term-term-name'. For visual
> commands (which use term.el), the terminal can do a lot more than just
> setting colors, such as moving the cursor around. "Normal", non-visual
> Eshell can't do that, so I think using the same setting for $TERM would
> be wrong.
>
> We could make Eshell set $TERM to "dumb-emacs-ansi", which should have
> the correct terminal settings. I believe that terminfo has been
> upstreamed into ncurses.
>
> However, I think if you want colors, it's best to change
> 'comint-terminfo-terminal' instead to "dumb-emacs-ansi" (and then Eshell
> will use that setting automatically). I *don't* think we should change
> 'comint-terminfo-terminal' by default though; that would be pretty
> invasive. Maybe we could use the Customize interface to make selecting
> "dumb-emacs-ansi" a matter of just checking a box, instead of typing it
> out by hand?

Thank you for the explanation, very clear.
Please feel free to ignore the patch and close this ticket. Thanks





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01 19:37     ` Lin Sun
@ 2024-05-01 19:49       ` Lin Sun
  2024-05-02  6:07       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Lin Sun @ 2024-05-01 19:49 UTC (permalink / raw)
  To: Jim Porter; +Cc: 70691, Eli Zaretskii

> it's best to change 'comint-terminfo-terminal' instead to "dumb-emacs-ansi"
And the "dumb-emacs-ansi" is included in the `ncurses-term` package
(ncurses-term-6.1 in my local).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default
  2024-05-01 19:37     ` Lin Sun
  2024-05-01 19:49       ` Lin Sun
@ 2024-05-02  6:07       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-05-02  6:07 UTC (permalink / raw)
  To: Lin Sun; +Cc: 70691, jporterbugs

tags 70691 notabug wontfix
close 70691
thanks

> From: Lin Sun <sunlin7.mail@gmail.com>
> Date: Wed, 1 May 2024 19:37:08 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>, 70691@debbugs.gnu.org
> 
> Thank you for the explanation, very clear.
> Please feel free to ignore the patch and close this ticket. Thanks

Done.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-02  6:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01  6:40 bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default Lin Sun
2024-05-01 12:15 ` Eli Zaretskii
2024-05-01 15:51   ` Lin Sun
2024-05-01 18:19   ` Jim Porter
2024-05-01 19:37     ` Lin Sun
2024-05-01 19:49       ` Lin Sun
2024-05-02  6:07       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.