unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* TERM and shell mode
@ 2023-03-03  0:18 Samuel Wales
  2023-03-03  1:37 ` Emanuel Berg
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Samuel Wales @ 2023-03-03  0:18 UTC (permalink / raw)
  To: help-gnu-emacs

ok, so this is going to be a really dumb question that i should have
figured out over the years.  and ... i sorta kinda but not really did
but i have too many notes and can't fiure them out.

and even legacy shell stuff from xemacs days and such.

emacs -Q says dumb for TERM for shell mode.  one issue with this i
have a note saying is that colored output can silently corrupt cmd |
grep if TERM=dumb.  or similr.  idr the details.  but i recall the
problem and debugged it to the TERM variable.

termprarily setting term to xterm fixed that problem but i have no
idea where it is being set permanntly.

i can't actually figure out where in my shell code or elsewhere the
following occurs: TERM gets set to xterm.  it works well or seems to
but it might be WRONG on the internet.  and root vs. user and linux vt
console might require special casing.

-Q says supposed to be dumb, except i also recall emacs as a terminal
type.  dunno where that came from.

literally i have no shell code that sets the var althuogh it is used
as a prefix to grep and such.  of course i am not asking you to intuit
where the variable is being set but you might have interesting
comments about TERM.

example.  thisis probably bad code but it helps with grep

    TERM=xterm \
        LC_ALL=C grep -i --color=auto --devices=skip --directories=skip "$@"

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



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

* Re: TERM and shell mode
  2023-03-03  0:18 TERM and shell mode Samuel Wales
@ 2023-03-03  1:37 ` Emanuel Berg
  2023-03-03  1:39 ` Emanuel Berg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Emanuel Berg @ 2023-03-03  1:37 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> ok, so this is going to be a really dumb question [...]

This is an emacs-dumb answer, but it's what I get with
M-x shell RET and then echo $TERM.

Note that there are other virtual terminals for Emacs, one
written in C that should have much more power than what you
get with `shell' - maybe it's more intelligent, even.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: TERM and shell mode
  2023-03-03  0:18 TERM and shell mode Samuel Wales
  2023-03-03  1:37 ` Emanuel Berg
@ 2023-03-03  1:39 ` Emanuel Berg
  2023-03-03  5:05 ` Akib Azmain Turja
  2023-03-03  7:21 ` Eli Zaretskii
  3 siblings, 0 replies; 8+ messages in thread
From: Emanuel Berg @ 2023-03-03  1:39 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> emacs -Q says dumb for TERM for shell mode

You are right, it does, I had that configured, no idea why
by now.

DANGER: DON'T try this if you want to stay dumb:

  (setq comint-terminfo-terminal "emacs-dumb")

OTOH if you want to become emacs-dumb, do EXACTLY like me!

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: TERM and shell mode
  2023-03-03  0:18 TERM and shell mode Samuel Wales
  2023-03-03  1:37 ` Emanuel Berg
  2023-03-03  1:39 ` Emanuel Berg
@ 2023-03-03  5:05 ` Akib Azmain Turja
  2023-03-03  7:21 ` Eli Zaretskii
  3 siblings, 0 replies; 8+ messages in thread
From: Akib Azmain Turja @ 2023-03-03  5:05 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs

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

Samuel Wales <samologist@gmail.com> writes:

> ok, so this is going to be a really dumb question that i should have
> figured out over the years.  and ... i sorta kinda but not really did
> but i have too many notes and can't fiure them out.
>
> and even legacy shell stuff from xemacs days and such.
>
> emacs -Q says dumb for TERM for shell mode.  one issue with this i
> have a note saying is that colored output can silently corrupt cmd |
> grep if TERM=dumb.  or similr.  idr the details.  but i recall the
> problem and debugged it to the TERM variable.
>
> termprarily setting term to xterm fixed that problem but i have no
> idea where it is being set permanntly.
>

Setting TERM to xterm will fix the issue for some programs, but will
create a big problem when you run Emacs or GNU Screen in Shell mode.
By the way, you can use Coterm to enable full terminal emulation in
Shell mode.

> i can't actually figure out where in my shell code or elsewhere the
> following occurs: TERM gets set to xterm.  it works well or seems to
> but it might be WRONG on the internet.  and root vs. user and linux vt
> console might require special casing.
>
> -Q says supposed to be dumb, except i also recall emacs as a terminal
> type.  dunno where that came from.
>
> literally i have no shell code that sets the var althuogh it is used
> as a prefix to grep and such.  of course i am not asking you to intuit
> where the variable is being set but you might have interesting
> comments about TERM.

It's probably your init file that's responsible.  What does the user
option (variable) 'comint-terminfo-terminal' contain?

>
> example.  thisis probably bad code but it helps with grep
>
>     TERM=xterm \
>         LC_ALL=C grep -i --color=auto --devices=skip --directories=skip "$@"

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: TERM and shell mode
  2023-03-03  0:18 TERM and shell mode Samuel Wales
                   ` (2 preceding siblings ...)
  2023-03-03  5:05 ` Akib Azmain Turja
@ 2023-03-03  7:21 ` Eli Zaretskii
  2023-03-03  7:39   ` Emanuel Berg
  2023-03-09  0:53   ` Samuel Wales
  3 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2023-03-03  7:21 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Samuel Wales <samologist@gmail.com>
> Date: Thu, 2 Mar 2023 17:18:29 -0700
> 
> emacs -Q says dumb for TERM for shell mode.  one issue with this i
> have a note saying is that colored output can silently corrupt cmd |
> grep if TERM=dumb.  or similr.  idr the details.  but i recall the
> problem and debugged it to the TERM variable.
> 
> termprarily setting term to xterm fixed that problem but i have no
> idea where it is being set permanntly.

Did you try to change the value of comint-terminfo-terminal?

Also, if you want to run programs that need colors or other features
of a terminal emulator, I think you should use "M-x ansi-term" instead
of "M-x shell", or at least try that to see if it solves your
problems.



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

* Re: TERM and shell mode
  2023-03-03  7:21 ` Eli Zaretskii
@ 2023-03-03  7:39   ` Emanuel Berg
  2023-03-09  0:53   ` Samuel Wales
  1 sibling, 0 replies; 8+ messages in thread
From: Emanuel Berg @ 2023-03-03  7:39 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii wrote:

> I think you should use "M-x ansi-term" instead of "M-x
> shell" see if it solves your problems.

Then TERM is eterm-color.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: TERM and shell mode
  2023-03-03  7:21 ` Eli Zaretskii
  2023-03-03  7:39   ` Emanuel Berg
@ 2023-03-09  0:53   ` Samuel Wales
  2023-03-09  4:47     ` Akib Azmain Turja
  1 sibling, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2023-03-09  0:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

that var does not exist in my emacs version, so i did not set it.  i
guess i should let sleeping dogs lie until new versions.

i want shell mode's features, not a terminal.  shell mode works with
ansi colors.  i find emacs term to be buggy.

yes, i should try vterm at some point.  and coterm.

i have no settings of xterm in shell or elisp.

On 3/3/23, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Samuel Wales <samologist@gmail.com>
>> Date: Thu, 2 Mar 2023 17:18:29 -0700
>>
>> emacs -Q says dumb for TERM for shell mode.  one issue with this i
>> have a note saying is that colored output can silently corrupt cmd |
>> grep if TERM=dumb.  or similr.  idr the details.  but i recall the
>> problem and debugged it to the TERM variable.
>>
>> termprarily setting term to xterm fixed that problem but i have no
>> idea where it is being set permanntly.
>
> Did you try to change the value of comint-terminfo-terminal?
>
> Also, if you want to run programs that need colors or other features
> of a terminal emulator, I think you should use "M-x ansi-term" instead
> of "M-x shell", or at least try that to see if it solves your
> problems.
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



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

* Re: TERM and shell mode
  2023-03-09  0:53   ` Samuel Wales
@ 2023-03-09  4:47     ` Akib Azmain Turja
  0 siblings, 0 replies; 8+ messages in thread
From: Akib Azmain Turja @ 2023-03-09  4:47 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Eli Zaretskii, help-gnu-emacs

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

Samuel Wales <samologist@gmail.com> writes:

> yes, i should try vterm at some point.  and coterm.

And maybe Eat?  (Well, I'm advertising my own terminal emulator.  ;P )

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2023-03-09  4:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03  0:18 TERM and shell mode Samuel Wales
2023-03-03  1:37 ` Emanuel Berg
2023-03-03  1:39 ` Emanuel Berg
2023-03-03  5:05 ` Akib Azmain Turja
2023-03-03  7:21 ` Eli Zaretskii
2023-03-03  7:39   ` Emanuel Berg
2023-03-09  0:53   ` Samuel Wales
2023-03-09  4:47     ` Akib Azmain Turja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).