From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: Terminal emulator in Windows Date: Wed, 11 Jan 2023 11:52:03 -0800 Message-ID: <0d991256-94ae-ed25-9191-89bb540634d7@gmail.com> References: <87bkn6hkwa.fsf@disroot.org> <83a62qo72p.fsf@gnu.org> <877cxunz6c.fsf@disroot.org> <83wn5umi8j.fsf@gnu.org> <87zgapmn1z.fsf@disroot.org> <39709a0d-0baf-3ca8-8c26-72dff4a53e25@gmail.com> <87v8ldkjvv.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35125"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Akib Azmain Turja Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 11 20:53:02 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFh9i-0008hc-04 for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Jan 2023 20:53:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFh8u-0006mr-Gd; Wed, 11 Jan 2023 14:52:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFh8s-0006mj-RF for emacs-devel@gnu.org; Wed, 11 Jan 2023 14:52:10 -0500 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFh8q-00079o-Pq; Wed, 11 Jan 2023 14:52:10 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id g23so2309925plq.12; Wed, 11 Jan 2023 11:52:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=6K+uH+9XIokSxYNF2jayUHy1Xwxb6M0YBoDPacT3KCM=; b=Fp3Egagp+BytJGvXbn6WC9RYp1onVfy4wuNAR3eHHmJ++L2INcZ+61wKP4a2vwQvoJ bRmejypolOxJ31/D5P3cIyRpklycYxFlMcnkmGVhecGJFXHKy9FnM35dmE8KHwrFpDqV upI3/z8w9Hlx10qRR+7mcO7xAXlNXCtpfc0yy1wy2Lf71koNiWs0xSQ9PeeXYdVkGBn5 3WqTfZua5b5TA72oQhQybVTtzYAcPUrUggZiAmN4EWbUb89RS5R4l+9VBra6u1ie7cR1 M4gRdjUGwFVrrBfFSHv6jcvOJpRi+XE9X1O/LvGITU4xj+5SawNzT21NFJ0jH+vKJ0fd 3Flw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6K+uH+9XIokSxYNF2jayUHy1Xwxb6M0YBoDPacT3KCM=; b=sLx5io68Y1R+Uzbyj9GRgSRLxDujRXSrdND3MCQVxcHni3Io7bdTtAjIFJElpcBQJu V6kPMbv/9EJoGbTnQuWZWJ2IYrvHe3qwUrKSzSxQ0ly9vbIZREMbAZwZ92NZEOSs49qT IzpNIw77qkWCPWceLFEMp4Fkfiq+AtIWBG0/c6vY6vKDq7kWiTtihBfduzsjWwHUhZmH dDAa0oHNJ7C5T6xyAtHWS3t7AnrADvM+/XplnE9p2ZnDkiqYFuuHGjzByxWsY4sWM0mf E4p0vMPI1kPm/EurXBsZDXvw5gUCFqQ7BnXu7vD7KHw9omLiexJ66FOSp47oGXQuBju6 +1gA== X-Gm-Message-State: AFqh2krpJ2wqlofZGBEPZXothe8KHL0GKNJEddzc1E6SUqDe1rw+4ai9 yy+DjRa6giL5iW2ogdxF92A= X-Google-Smtp-Source: AMrXdXvnjQ+seGILON/HLXGZ2O/+G9qu+PMxn3D8/TTlJQ6F+1Gk6AKuFASsvPeewTkFXsaCVm/rQA== X-Received: by 2002:a17:90a:af91:b0:219:de9b:f397 with SMTP id w17-20020a17090aaf9100b00219de9bf397mr77084456pjq.3.1673466726101; Wed, 11 Jan 2023 11:52:06 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id oa11-20020a17090b1bcb00b00212cf2fe8c3sm6196224pjb.1.2023.01.11.11.52.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Jan 2023 11:52:05 -0800 (PST) Content-Language: en-US In-Reply-To: <87v8ldkjvv.fsf@disroot.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302360 Archived-At: On 1/11/2023 10:26 AM, Akib Azmain Turja wrote: > Jim Porter 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