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.bugs Subject: bug#57635: 29.0.50; Look into using generator.el's CPS machinery to replace 'eshell-do-eval' Date: Sun, 11 Sep 2022 18:01:04 -0700 Message-ID: <302b247c-2269-78ca-07e2-ad6c6f93fe1d@gmail.com> References: <1766577e-022f-87ae-873e-875d84078891@gmail.com> 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="26444"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57635@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 12 03:02:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1oXXq3-0006m3-1V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Sep 2022 03:02:15 +0200 Original-Received: from localhost ([::1]:51842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXXq1-0007wu-KQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Sep 2022 21:02:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXXpq-0007wk-Pb for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 21:02:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXXpq-0008OF-Gg for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 21:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXXpq-0005jw-0p for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 21:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Sep 2022 01:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57635 X-GNU-PR-Package: emacs Original-Received: via spool by 57635-submit@debbugs.gnu.org id=B57635.166294447722014 (code B ref 57635); Mon, 12 Sep 2022 01:02:01 +0000 Original-Received: (at 57635) by debbugs.gnu.org; 12 Sep 2022 01:01:17 +0000 Original-Received: from localhost ([127.0.0.1]:43753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXXp7-0005iz-0R for submit@debbugs.gnu.org; Sun, 11 Sep 2022 21:01:17 -0400 Original-Received: from mail-pj1-f42.google.com ([209.85.216.42]:52041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXXp2-0005ij-2J for 57635@debbugs.gnu.org; Sun, 11 Sep 2022 21:01:16 -0400 Original-Received: by mail-pj1-f42.google.com with SMTP id m3so6521038pjo.1 for <57635@debbugs.gnu.org>; Sun, 11 Sep 2022 18:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :date:message-id:from:references:cc:to:subject:from:to:cc:subject :date; bh=uT1Nz8zbWMkTwle340k3hOTBDNoOYyna4jrOdh/A/V8=; b=lCBy3nhzSQm/EFiMnKDF7+EhM4zvveIxfsFgwThtLJNsg8Qm+19dyOlcUAHHV7NW4p HpmRflmRZ6NCkcKFnf+JEto+ZqLrsaFZnZFuqByB7Bh19nZJ/26GDERC+syR4B0eW/iz c4sKtFSbrbY39QcOrEatjZgiBl0v8lduy9GwEk942MgNFLsazVuZ95I27Egs3b0wJq8A oJVlNoGS4AYobcQYf4/Galdq+umOWV/e0jE/O/AU0oTo/Dauk0JxxLJIQqHM842HxDl4 Inc/lHq8WozdVWIVRQK1WattbVJo7m36xCl5LS2vVDIi4c/LYTg0SKMEKflThNtAb7P3 WUKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :date:message-id:from:references:cc:to:subject:x-gm-message-state :from:to:cc:subject:date; bh=uT1Nz8zbWMkTwle340k3hOTBDNoOYyna4jrOdh/A/V8=; b=iH8AGFfYUhxID78jT8bY3Q7Fo7rnHy/ZNI8SBqdC5r4b7NorwnfA9364tePGbL7HwP hbM07KsTDAQkvViCIPV2i5Yr+YJtNSZMZ/+BWdhcqfDUIDnAJw2qUa/TyDRSbTOiDIVI QAM5ji3HWRqeMn6H5p8wGMLEo5aHefBxrZYLnqPuQ0XfoaK9pbVcaoo5xOjTfouwTCwx 2m+O36LOnzADxF3ei26Y1a3l9iOxCVOvtxyj9O75DnOhH8YZlB1AcPgOGj671mgsd+BI gd4MWER71/mwF5OK1CToWoUR2MkA6y4Viv+haFUm41MW/ZGurH6RkSB1FUHcxHtJ3V1L wUTQ== X-Gm-Message-State: ACgBeo14pe2dUIkb7SeZeDuR578RZilDNFKXVYFoliYY54u6+GaTnmhR syM74wzzFyJ4zHSirYlqJjCAUPb9xi4= X-Google-Smtp-Source: AA6agR5xFDaC5luR924V1p5iR6L6fgc0QAYnfW5S8nPGxc476TsmvAbur0bEf6iNzMX0VftA8VgkwA== X-Received: by 2002:a17:903:120c:b0:172:728a:3b24 with SMTP id l12-20020a170903120c00b00172728a3b24mr24001860plh.61.1662944466120; Sun, 11 Sep 2022 18:01:06 -0700 (PDT) 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 199-20020a6214d0000000b0053e22c7f135sm4008781pfu.141.2022.09.11.18.01.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Sep 2022 18:01:05 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242202 Archived-At: On 9/7/2022 5:45 AM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Indeed, the idea would be to replace the commands that launch processes > with "yields" to an external loop (that just launches the next process > and then calls the generator again). That part should be fairly straightforward; there's already 'eshell-eval-command' and friends ('eshell-resume-command', 'eshell-resume-eval', and 'eshell-do-eval'), which work pretty much like this already. Looking through this, I see a few main differences between how Eshell does things and how generator.el does things: ---------------------------------------- 1) Eshell uses (throw 'eshell-defer) to yield This is probably easy to fix, since it's only used in a couple places, and it looks like it's purely an implementation detail. 2) Eshell doesn't have anything like 'iter-defun' Eshell just evaluates a Lisp form directly (you can see this by tracing 'eshell-eval-command' and then running some external process in Eshell). I'm not sure how hard it would be to get generator.el to be ok with this. 3) Eshell allows replacing a form by throwing 'eshell-replace-command' This is the trickiest part (to me, anyway). It's typically used by Eshell built-in commands when they want to give up and run an external process, though it can be used for a bunch of other things. I'm not sure what the best way to handle this via generator.el would be. Is there any straightforward way to do this? ---------------------------------------- If anyone has ideas, I'm all ears. This is pretty far down into the weeds of Lisp metaprogramming, so I'm just making some educated guesses here. I think doing this would be a big improvement for Eshell though, since I've already bumped up against a few cases that really look like they're just bugs in 'eshell-do-eval'. Moving to generator.el would hopefully fix those and make Eshell easier to maintain/improve.