unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Terminal emulator in Windows
@ 2023-01-10  8:08 Akib Azmain Turja
  2023-01-10 13:25 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-10  8:08 UTC (permalink / raw)
  To: Emacs Developer List

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


Hi there,

As far as I know, terminal emulation doesn't work in Windows by default.
Was anyone able to make terminal emulation in Windows work, with a
shell?  If yes, how?

[  I guess this is off-topic, I apologize.
   I don't use Windows, but someone asked for Windows support in Eat,
   that's why I'm asking here.  ]

Thanks in advance.

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-10  8:08 Terminal emulator in Windows Akib Azmain Turja
@ 2023-01-10 13:25 ` Eli Zaretskii
  2023-01-10 16:15   ` Akib Azmain Turja
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-10 13:25 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Date: Tue, 10 Jan 2023 14:08:21 +0600
> 
> As far as I know, terminal emulation doesn't work in Windows by default.
> Was anyone able to make terminal emulation in Windows work, with a
> shell?  If yes, how?

If by "terminal emulation" you mean term.el, then it doesn't work on
MS-Windows because it requires two Posix features that AFAIK aren't
available on Windows, certainly not with the Windows default shell:

  . terminfo
  . stty settings

In addition, I'm not sure that Windows shells will work with the
process-connection-type being nil (i.e. via pipes instead of PTYs),
which is another feature that is missing on MS-Windows.



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

* Re: Terminal emulator in Windows
  2023-01-10 13:25 ` Eli Zaretskii
@ 2023-01-10 16:15   ` Akib Azmain Turja
  2023-01-10 17:06     ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-10 16:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Akib Azmain Turja <akib@disroot.org>
>> Date: Tue, 10 Jan 2023 14:08:21 +0600
>> 
>> As far as I know, terminal emulation doesn't work in Windows by default.
>> Was anyone able to make terminal emulation in Windows work, with a
>> shell?  If yes, how?
>
> If by "terminal emulation" you mean term.el, then it doesn't work on

No, not term.el, I'm willing to add the feature to my own terminal
emulator (though I don't use Losedows).

> MS-Windows because it requires two Posix features that AFAIK aren't
> available on Windows, certainly not with the Windows default shell:
>
>   . terminfo
>   . stty settings

Yes, AFAIK.

>
> In addition, I'm not sure that Windows shells will work with the
> process-connection-type being nil (i.e. via pipes instead of PTYs),
> which is another feature that is missing on MS-Windows.
>

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-10 16:15   ` Akib Azmain Turja
@ 2023-01-10 17:06     ` Eli Zaretskii
  2023-01-11  9:35       ` Akib Azmain Turja
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-10 17:06 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 10 Jan 2023 22:15:39 +0600
> 
> > If by "terminal emulation" you mean term.el, then it doesn't work on
> 
> No, not term.el, I'm willing to add the feature to my own terminal
> emulator (though I don't use Losedows).

Then what do you mean by "terminal emulation" which doesn't work?



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

* Re: Terminal emulator in Windows
  2023-01-10 17:06     ` Eli Zaretskii
@ 2023-01-11  9:35       ` Akib Azmain Turja
  2023-01-11 10:14         ` Po Lu
                           ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11  9:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Akib Azmain Turja <akib@disroot.org>
>> Cc: emacs-devel@gnu.org
>> Date: Tue, 10 Jan 2023 22:15:39 +0600
>>
>> > If by "terminal emulation" you mean term.el, then it doesn't work on
>>
>> No, not term.el, I'm willing to add the feature to my own terminal
>> emulator (though I don't use Losedows).
>
> Then what do you mean by "terminal emulation" which doesn't work?

In general, is it possible to implement Windows terminal emulation?

I think it'd be best to leave this for *"Windows users"* to answer.

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11  9:35       ` Akib Azmain Turja
@ 2023-01-11 10:14         ` Po Lu
  2023-01-11 12:48           ` Eli Zaretskii
  2023-01-11 15:26           ` Akib Azmain Turja
  2023-01-11 12:42         ` Eli Zaretskii
  2023-01-11 17:31         ` Jim Porter
  2 siblings, 2 replies; 21+ messages in thread
From: Po Lu @ 2023-01-11 10:14 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: Eli Zaretskii, emacs-devel

Akib Azmain Turja <akib@disroot.org> writes:

> In general, is it possible to implement Windows terminal emulation?

Since MS Windows has never been used connected to text terminals, what
would be the point?

AFAIU it is possible to run command.com in a shell buffer, but when you
do that you cannot restart the system without it being wedged.  I think
that is the more important thing to fix, but I don't know where to
start.



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

* Re: Terminal emulator in Windows
  2023-01-11  9:35       ` Akib Azmain Turja
  2023-01-11 10:14         ` Po Lu
@ 2023-01-11 12:42         ` Eli Zaretskii
  2023-01-11 15:11           ` Akib Azmain Turja
  2023-01-11 17:31         ` Jim Porter
  2 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 12:42 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 11 Jan 2023 15:35:04 +0600
> 
> > Then what do you mean by "terminal emulation" which doesn't work?
> 
> In general, is it possible to implement Windows terminal emulation?

There's mintty, so I guess the answer is YES?

> I think it'd be best to leave this for *"Windows users"* to answer.

Does it mean you think I shouldn't answer your questions?



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

* Re: Terminal emulator in Windows
  2023-01-11 10:14         ` Po Lu
@ 2023-01-11 12:48           ` Eli Zaretskii
  2023-01-11 13:01             ` Po Lu
  2023-01-11 15:26           ` Akib Azmain Turja
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 12:48 UTC (permalink / raw)
  To: Po Lu; +Cc: akib, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Wed, 11 Jan 2023 18:14:54 +0800
> 
> Akib Azmain Turja <akib@disroot.org> writes:
> 
> > In general, is it possible to implement Windows terminal emulation?
> 
> Since MS Windows has never been used connected to text terminals, what
> would be the point?

I don't think this is accurate.  Windows XP implements the telnet
protocol, so you can connect to it from a remote system.

> AFAIU it is possible to run command.com in a shell buffer, but when you
> do that you cannot restart the system without it being wedged.  I think
> that is the more important thing to fix, but I don't know where to
> start.

I'm not sure I see the relevance.  cmd.exe can indeed be run via
"M-x shell", but that's not a terminal emulator, since terminal
commands (like cursor movement and colors) are not supported.
"M-x shell" is just a simple text-mode interface to the shell
and any console commands you run.



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

* Re: Terminal emulator in Windows
  2023-01-11 12:48           ` Eli Zaretskii
@ 2023-01-11 13:01             ` Po Lu
  2023-01-11 13:19               ` Eli Zaretskii
  2023-01-11 14:19               ` Rudolf Schlatte
  0 siblings, 2 replies; 21+ messages in thread
From: Po Lu @ 2023-01-11 13:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: akib, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Po Lu <luangruo@yahoo.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
>> Date: Wed, 11 Jan 2023 18:14:54 +0800
>> 
>> Akib Azmain Turja <akib@disroot.org> writes:
>> 
>> > In general, is it possible to implement Windows terminal emulation?
>> 
>> Since MS Windows has never been used connected to text terminals, what
>> would be the point?
>
> I don't think this is accurate.  Windows XP implements the telnet
> protocol, so you can connect to it from a remote system.
>
>> AFAIU it is possible to run command.com in a shell buffer, but when you
>> do that you cannot restart the system without it being wedged.  I think
>> that is the more important thing to fix, but I don't know where to
>> start.
>
> I'm not sure I see the relevance.  cmd.exe can indeed be run via
> "M-x shell", but that's not a terminal emulator, since terminal
> commands (like cursor movement and colors) are not supported.
> "M-x shell" is just a simple text-mode interface to the shell
> and any console commands you run.

Right, but Windows doesn't have a native, terminal interface with cursor
movement, correct?

As far as I know, mintty and other tools are for the Cygwin Unix
environment, and term.el does work on a Cygwin build of Emacs.



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

* Re: Terminal emulator in Windows
  2023-01-11 13:01             ` Po Lu
@ 2023-01-11 13:19               ` Eli Zaretskii
  2023-01-11 14:19               ` Rudolf Schlatte
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 13:19 UTC (permalink / raw)
  To: Po Lu; +Cc: akib, emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: akib@disroot.org,  emacs-devel@gnu.org
> Date: Wed, 11 Jan 2023 21:01:07 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Po Lu <luangruo@yahoo.com>
> >> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
> >> Date: Wed, 11 Jan 2023 18:14:54 +0800
> >> 
> >> Akib Azmain Turja <akib@disroot.org> writes:
> >> 
> >> > In general, is it possible to implement Windows terminal emulation?
> >> 
> >> Since MS Windows has never been used connected to text terminals, what
> >> would be the point?
> >
> > I don't think this is accurate.  Windows XP implements the telnet
> > protocol, so you can connect to it from a remote system.
> >
> >> AFAIU it is possible to run command.com in a shell buffer, but when you
> >> do that you cannot restart the system without it being wedged.  I think
> >> that is the more important thing to fix, but I don't know where to
> >> start.
> >
> > I'm not sure I see the relevance.  cmd.exe can indeed be run via
> > "M-x shell", but that's not a terminal emulator, since terminal
> > commands (like cursor movement and colors) are not supported.
> > "M-x shell" is just a simple text-mode interface to the shell
> > and any console commands you run.
> 
> Right, but Windows doesn't have a native, terminal interface with cursor
> movement, correct?

I think it does, but it is almost never used.  I remember at some
point logging into a Windows system via telnet, which emulated vt100.



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

* Re: Terminal emulator in Windows
  2023-01-11 13:01             ` Po Lu
  2023-01-11 13:19               ` Eli Zaretskii
@ 2023-01-11 14:19               ` Rudolf Schlatte
  2023-01-11 15:18                 ` Akib Azmain Turja
  1 sibling, 1 reply; 21+ messages in thread
From: Rudolf Schlatte @ 2023-01-11 14:19 UTC (permalink / raw)
  To: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Po Lu <luangruo@yahoo.com>
>>> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
>>> Date: Wed, 11 Jan 2023 18:14:54 +0800
>>> 
>>> Akib Azmain Turja <akib@disroot.org> writes:
>>> 
>>> > In general, is it possible to implement Windows terminal emulation?
>>> 
>>> Since MS Windows has never been used connected to text terminals, what
>>> would be the point?
>>
>> I don't think this is accurate.  Windows XP implements the telnet
>> protocol, so you can connect to it from a remote system.
>>
>>> AFAIU it is possible to run command.com in a shell buffer, but when you
>>> do that you cannot restart the system without it being wedged.  I think
>>> that is the more important thing to fix, but I don't know where to
>>> start.
>>
>> I'm not sure I see the relevance.  cmd.exe can indeed be run via
>> "M-x shell", but that's not a terminal emulator, since terminal
>> commands (like cursor movement and colors) are not supported.
>> "M-x shell" is just a simple text-mode interface to the shell
>> and any console commands you run.
>
> Right, but Windows doesn't have a native, terminal interface with cursor
> movement, correct?

I believe Windows got one relatively recently, see this blog post from
2018:

https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/




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

* Re: Terminal emulator in Windows
  2023-01-11 12:42         ` Eli Zaretskii
@ 2023-01-11 15:11           ` Akib Azmain Turja
  2023-01-11 17:01             ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11 15:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

Eli Zaretskii <eliz@gnu.org> writes:

>> I think it'd be best to leave this for *"Windows users"* to answer.
>
> Does it mean you think I shouldn't answer your questions?

No, not really.  My question is that whether terminal emulation in Emacs
is possible in Windows using only Elisp, but you're just talking
specifically about term.el.  My question will probably be better
answered by the Windows users.

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11 14:19               ` Rudolf Schlatte
@ 2023-01-11 15:18                 ` Akib Azmain Turja
  2023-01-11 17:01                   ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11 15:18 UTC (permalink / raw)
  To: Rudolf Schlatte; +Cc: emacs-devel

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

Rudolf Schlatte <rudi@constantly.at> writes:

> Po Lu <luangruo@yahoo.com> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Po Lu <luangruo@yahoo.com>
>>>> Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
>>>> Date: Wed, 11 Jan 2023 18:14:54 +0800
>>>> 
>>>> Akib Azmain Turja <akib@disroot.org> writes:
>>>> 
>>>> > In general, is it possible to implement Windows terminal emulation?
>>>> 
>>>> Since MS Windows has never been used connected to text terminals, what
>>>> would be the point?
>>>
>>> I don't think this is accurate.  Windows XP implements the telnet
>>> protocol, so you can connect to it from a remote system.
>>>
>>>> AFAIU it is possible to run command.com in a shell buffer, but when you
>>>> do that you cannot restart the system without it being wedged.  I think
>>>> that is the more important thing to fix, but I don't know where to
>>>> start.
>>>
>>> I'm not sure I see the relevance.  cmd.exe can indeed be run via
>>> "M-x shell", but that's not a terminal emulator, since terminal
>>> commands (like cursor movement and colors) are not supported.
>>> "M-x shell" is just a simple text-mode interface to the shell
>>> and any console commands you run.
>>
>> Right, but Windows doesn't have a native, terminal interface with cursor
>> movement, correct?
>
> I believe Windows got one relatively recently, see this blog post from
> 2018:
>
> https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
>
>

Hmm, a quick internet search reveals that the thing is an API, not an
escape sequence protocol like the VT series terminals or ECMA-48
specification.

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11 10:14         ` Po Lu
  2023-01-11 12:48           ` Eli Zaretskii
@ 2023-01-11 15:26           ` Akib Azmain Turja
  1 sibling, 0 replies; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11 15:26 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel

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

Po Lu <luangruo@yahoo.com> writes:

> Akib Azmain Turja <akib@disroot.org> writes:
>
>> In general, is it possible to implement Windows terminal emulation?
>
> Since MS Windows has never been used connected to text terminals, what
> would be the point?
>

MSDOS used to be, didn't it?

> AFAIU it is possible to run command.com in a shell buffer, but when you
> do that you cannot restart the system without it being wedged.  I think

I don't understand; can you explain please?

> that is the more important thing to fix, but I don't know where to
> start.
>

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11 15:18                 ` Akib Azmain Turja
@ 2023-01-11 17:01                   ` Eli Zaretskii
  2023-01-11 18:27                     ` Akib Azmain Turja
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 17:01 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: rudi, emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 11 Jan 2023 21:18:46 +0600
> 
> > https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
> >
> 
> Hmm, a quick internet search reveals that the thing is an API, not an
> escape sequence protocol like the VT series terminals or ECMA-48
> specification.

It is actually both.  The pseudo-console supports SGR sequences.  But
it has other problems...



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

* Re: Terminal emulator in Windows
  2023-01-11 15:11           ` Akib Azmain Turja
@ 2023-01-11 17:01             ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 17:01 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 11 Jan 2023 21:11:35 +0600
> 
> My question will probably be better answered by the Windows users.

Why do you think I'm not one of them?



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

* Re: Terminal emulator in Windows
  2023-01-11  9:35       ` Akib Azmain Turja
  2023-01-11 10:14         ` Po Lu
  2023-01-11 12:42         ` Eli Zaretskii
@ 2023-01-11 17:31         ` Jim Porter
  2023-01-11 18:26           ` Akib Azmain Turja
  2 siblings, 1 reply; 21+ messages in thread
From: Jim Porter @ 2023-01-11 17:31 UTC (permalink / raw)
  To: Akib Azmain Turja, Eli Zaretskii; +Cc: emacs-devel

On 1/11/2023 1:35 AM, Akib Azmain Turja wrote:
> In general, is it possible to implement Windows terminal emulation?

Do you mean "emulating cmd.exe" or "emulating a terminal and running 
that emulator on MS Windows"? The former might be trickier, and I 
haven't really looked into how you'd do that. However, the latter might 
just mean handling VT100 terminal sequences, which I don't think would 
require knowing about any Windows-specific features/APIs.

I believe newer versions of MS Windows can support VT100 sequences, so 
some applications compiled for Windows will likely use them. It would 
also be useful for a Windows user who connects to a remote *nix system 
(e.g. via Tramp); a program like `less` on the remote system would 
likely emit VT100 sequences, so it'd be nice to handle those, even if 
it's being displayed in an Emacs session running on MS Windows.



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

* Re: Terminal emulator in Windows
  2023-01-11 17:31         ` Jim Porter
@ 2023-01-11 18:26           ` Akib Azmain Turja
  2023-01-11 19:52             ` Jim Porter
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11 18:26 UTC (permalink / raw)
  To: Jim Porter; +Cc: Eli Zaretskii, emacs-devel

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

Jim Porter <jporterbugs@gmail.com> writes:

> On 1/11/2023 1:35 AM, Akib Azmain Turja wrote:
>> In general, is it possible to implement Windows terminal emulation?
>
> Do you mean "emulating cmd.exe" or "emulating a terminal and running
> that emulator on MS Windows"? The former might be trickier, and I

I started the thread, and even I don't know.  But I guess the latter.
For more information, you may check the Eat issue 35 on Codeberg:
https://codeberg.org/akib/emacs-eat/issues/35

> haven't really looked into how you'd do that. However, the latter
> might just mean handling VT100 terminal sequences, which I don't think
> would require knowing about any Windows-specific features/APIs.

But somehow we need to tell the program what escape sequences to send,
don't we?

>
> I believe newer versions of MS Windows can support VT100 sequences, so
> some applications compiled for Windows will likely use them. It would
> also be useful for a Windows user who connects to a remote *nix system
> (e.g. via Tramp); a program like `less` on the remote system would
> likely emit VT100 sequences, so it'd be nice to handle those, even if
> it's being displayed in an Emacs session running on MS Windows.
>

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11 17:01                   ` Eli Zaretskii
@ 2023-01-11 18:27                     ` Akib Azmain Turja
  2023-01-11 19:55                       ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: Akib Azmain Turja @ 2023-01-11 18:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rudi, emacs-devel

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Akib Azmain Turja <akib@disroot.org>
>> Cc: emacs-devel@gnu.org
>> Date: Wed, 11 Jan 2023 21:18:46 +0600
>> 
>> > https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
>> >
>> 
>> Hmm, a quick internet search reveals that the thing is an API, not an
>> escape sequence protocol like the VT series terminals or ECMA-48
>> specification.
>
> It is actually both.  The pseudo-console supports SGR sequences.  But
> it has other problems...
>

What?

-- 
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] 21+ messages in thread

* Re: Terminal emulator in Windows
  2023-01-11 18:26           ` Akib Azmain Turja
@ 2023-01-11 19:52             ` Jim Porter
  0 siblings, 0 replies; 21+ messages in thread
From: Jim Porter @ 2023-01-11 19:52 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: Eli Zaretskii, emacs-devel

On 1/11/2023 10:26 AM, Akib Azmain Turja wrote:
> Jim Porter <jporterbugs@gmail.com> writes:
> 
>> On 1/11/2023 1:35 AM, Akib Azmain Turja wrote:
>>> In general, is it possible to implement Windows terminal emulation?
>>
>> Do you mean "emulating cmd.exe" or "emulating a terminal and running
>> that emulator on MS Windows"? The former might be trickier, and I
> 
> I started the thread, and even I don't know.  But I guess the latter.
> For more information, you may check the Eat issue 35 on Codeberg:
> https://codeberg.org/akib/emacs-eat/issues/35

In some ways this issue actually sounds more like the former. It sounds 
like the user wants something like ConEmu[1] in Emacs. ConEmu's 
implementation seems pretty hacky to me, since it relies on an invisible 
Windows Console window[2].

On the other hand, there's the new-ish MS Windows API called ConPTY (as 
the name implies, it gives you a pseudoterminal). This would give us 
similar benefits compared to what ConEmu does, but using an 
explicitly-supported API for it. This would be nice, since then Emacs 
could just use pseudoterminals everywhere, which I think is what we 
want. Unfortunately, it seems that this API isn't suitable for Emacs, as 
discussed here[3] by Eli.

>> haven't really looked into how you'd do that. However, the latter
>> might just mean handling VT100 terminal sequences, which I don't think
>> would require knowing about any Windows-specific features/APIs.
> 
> But somehow we need to tell the program what escape sequences to send,
> don't we?

 From this discussion[4], it's the *program* that decides to opt in to 
sending VT100 sequences to a Windows console. That is, if I wrote a 
cross-platform program that uses VT100 sequences, I'd call 
'SetConsoleMode' with 'ENABLE_VIRTUAL_TERMINAL_PROCESSING' in my MS 
Windows port. Maybe Emacs could piggyback off of that.

I don't know if this would help solve the issue in the bug you linked, 
but maybe something like this would work for handling VT100 sequences in 
Eshell via 'eat-eshell-mode', or when running *nix programs remotely 
through Tramp.

[1] https://conemu.github.io/

[2] https://conemu.github.io/en/RealConsole.html

[3] https://github.com/microsoft/terminal/issues/9174

[4] https://news.ycombinator.com/item?id=25866634



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

* Re: Terminal emulator in Windows
  2023-01-11 18:27                     ` Akib Azmain Turja
@ 2023-01-11 19:55                       ` Eli Zaretskii
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2023-01-11 19:55 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: rudi, emacs-devel

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: rudi@constantly.at,  emacs-devel@gnu.org
> Date: Thu, 12 Jan 2023 00:27:28 +0600
> 
> >> > https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
> >> >
> >> 
> >> Hmm, a quick internet search reveals that the thing is an API, not an
> >> escape sequence protocol like the VT series terminals or ECMA-48
> >> specification.
> >
> > It is actually both.  The pseudo-console supports SGR sequences.  But
> > it has other problems...
> >
> 
> What?

Mainly its assumptions about the encoding of text read and written
through it.  I explained that here several times in the past, and I
filed an issue with the conpty developers.



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

end of thread, other threads:[~2023-01-11 19:55 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-10  8:08 Terminal emulator in Windows Akib Azmain Turja
2023-01-10 13:25 ` Eli Zaretskii
2023-01-10 16:15   ` Akib Azmain Turja
2023-01-10 17:06     ` Eli Zaretskii
2023-01-11  9:35       ` Akib Azmain Turja
2023-01-11 10:14         ` Po Lu
2023-01-11 12:48           ` Eli Zaretskii
2023-01-11 13:01             ` Po Lu
2023-01-11 13:19               ` Eli Zaretskii
2023-01-11 14:19               ` Rudolf Schlatte
2023-01-11 15:18                 ` Akib Azmain Turja
2023-01-11 17:01                   ` Eli Zaretskii
2023-01-11 18:27                     ` Akib Azmain Turja
2023-01-11 19:55                       ` Eli Zaretskii
2023-01-11 15:26           ` Akib Azmain Turja
2023-01-11 12:42         ` Eli Zaretskii
2023-01-11 15:11           ` Akib Azmain Turja
2023-01-11 17:01             ` Eli Zaretskii
2023-01-11 17:31         ` Jim Porter
2023-01-11 18:26           ` Akib Azmain Turja
2023-01-11 19:52             ` Jim Porter

Code repositories for project(s) associated with this public inbox

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

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).