GNU bug report logs - #70691
30.0.50; [PATCH] Eshell's TERM env varible use eshell-term-name as default

Previous Next

Package: emacs;

Reported by: Lin Sun <sunlin7.mail <at> gmail.com>

Date: Wed, 1 May 2024 06:42:02 UTC

Severity: normal

Tags: notabug, patch, wontfix

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70691 in the body.
You can then email your comments to 70691 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 06:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lin Sun <sunlin7.mail <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 01 May 2024 06:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7.mail <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50;
 [PATCH] Eshell's TERM env varible use eshell-term-name as default
Date: Wed, 1 May 2024 06:40:25 +0000
[Message part 1 (text/plain, inline)]
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.
[0001-Eshell-s-TERM-env-varible-use-eshell-term-name-as-de.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 12:16:01 GMT) Full text and rfc822 format available.

Message #8 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lin Sun <sunlin7.mail <at> gmail.com>, Jim Porter <jporterbugs <at> gmail.com>
Cc: 70691 <at> debbugs.gnu.org
Subject: Re: bug#70691: 30.0.50;
 [PATCH] Eshell's TERM env varible use eshell-term-name as default
Date: Wed, 01 May 2024 15:15:03 +0300
> From: Lin Sun <sunlin7.mail <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 15:53:01 GMT) Full text and rfc822 format available.

Message #11 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7.mail <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70691 <at> debbugs.gnu.org, Jim Porter <jporterbugs <at> gmail.com>
Subject: Re: bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use
 eshell-term-name as default
Date: Wed, 1 May 2024 15:51:54 +0000
On Wed, May 1, 2024 at 12:15 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Lin Sun <sunlin7.mail <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 18:21:02 GMT) Full text and rfc822 format available.

Message #14 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Lin Sun <sunlin7.mail <at> gmail.com>
Cc: 70691 <at> debbugs.gnu.org
Subject: Re: bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use
 eshell-term-name as default
Date: Wed, 1 May 2024 11:19:39 -0700
On 5/1/2024 5:15 AM, Eli Zaretskii wrote:
>> From: Lin Sun <sunlin7.mail <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 19:38:02 GMT) Full text and rfc822 format available.

Message #17 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7.mail <at> gmail.com>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 70691 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use
 eshell-term-name as default
Date: Wed, 1 May 2024 19:37:08 +0000
On Wed, May 1, 2024 at 6:19 PM Jim Porter <jporterbugs <at> gmail.com> wrote:
>
> On 5/1/2024 5:15 AM, Eli Zaretskii wrote:
> >> From: Lin Sun <sunlin7.mail <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Wed, 01 May 2024 19:50:02 GMT) Full text and rfc822 format available.

Message #20 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7.mail <at> gmail.com>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 70691 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use
 eshell-term-name as default
Date: Wed, 1 May 2024 19:49:18 +0000
> 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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70691; Package emacs. (Thu, 02 May 2024 06:08:01 GMT) Full text and rfc822 format available.

Message #23 received at 70691 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lin Sun <sunlin7.mail <at> gmail.com>
Cc: 70691 <at> debbugs.gnu.org, jporterbugs <at> gmail.com
Subject: Re: bug#70691: 30.0.50; [PATCH] Eshell's TERM env varible use
 eshell-term-name as default
Date: Thu, 02 May 2024 09:07:16 +0300
tags 70691 notabug wontfix
close 70691
thanks

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

Done.




Added tag(s) wontfix and notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 02 May 2024 06:08:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 70691 <at> debbugs.gnu.org and Lin Sun <sunlin7.mail <at> gmail.com> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 02 May 2024 06:08:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 May 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.