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#25270: eshell -- programmatically send input -- feature request Date: Mon, 16 May 2022 10:33:49 -0700 Message-ID: <55a88436-93c9-8944-2191-aa6c45f869cb@gmail.com> References: <87tu9tsf78.fsf@gnus.org> <9f52fe73-30ef-edf9-1d5b-2bf134e69dac@gmail.com> <87o7zxfzfs.fsf@gnus.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="40367"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Keith David Bershatsky , 25270@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 16 19:34:13 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 1nqebl-000AM7-RA for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 19:34:13 +0200 Original-Received: from localhost ([::1]:55518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqebk-0005rU-E4 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 13:34:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqeba-0005oM-HA for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 13:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqeba-00041P-8I for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 13:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqeba-0000MX-5a for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 13:34: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, 16 May 2022 17:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25270 X-GNU-PR-Package: emacs Original-Received: via spool by 25270-submit@debbugs.gnu.org id=B25270.16527224371383 (code B ref 25270); Mon, 16 May 2022 17:34:02 +0000 Original-Received: (at 25270) by debbugs.gnu.org; 16 May 2022 17:33:57 +0000 Original-Received: from localhost ([127.0.0.1]:54978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqebV-0000ME-AJ for submit@debbugs.gnu.org; Mon, 16 May 2022 13:33:57 -0400 Original-Received: from mail-pg1-f176.google.com ([209.85.215.176]:42839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqebT-0000Lw-67 for 25270@debbugs.gnu.org; Mon, 16 May 2022 13:33:55 -0400 Original-Received: by mail-pg1-f176.google.com with SMTP id 202so14712248pgc.9 for <25270@debbugs.gnu.org>; Mon, 16 May 2022 10:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=8j6pV0xF+pz63CKoE/wDJNKI+jdKvGmsZiw1IzCEDd8=; b=dKKktV2X6QErEAlZmSbIGeQTncUf8LH96Ocu9e6+XsQe9o4cdA+fDfV47eYWGTPv8c o4VkOxsaV7ZxCUBR8K01v64v0YdZBeJkNHCpO885PUdHG/n52uIrB8HiGtmSpIrl4JJs 9LjbOYEO4cBl36QJAyIa5KPBV2S1nsOJ0apTvg6we7sMrqE1+w/bsxQK/AVnGzwvp/PM tZeeeL69ATKyz9Z9AlnE9nWUDXd+ojRkoELofveYlMIy7M0HJdcKdMgT4LK2hkf32K19 Q7j2j5wHGDLd92wGD/e8iWy/I2CDKt1X0knB/dYSWYxTcYUdm7/oxneU0tYX5m7FGjYc o0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8j6pV0xF+pz63CKoE/wDJNKI+jdKvGmsZiw1IzCEDd8=; b=oh2Tizhu8lDdd9StMif9fKV1sZ+ddVrBq/+bY4hF+kxxs6mjVNvNg+7NN1Cy5k4fOI bYHcvkQt3XV2q1nRGRS7r5pfxmKo22CdG7wmoD9DaFsVX63OahXSZPQZsnUUQ41tGIQP f/mO1CH/tYA8KzDM6l3MegsD5HSoUipmfpqsERoSsGc9NbBEbJnyujjA5BmUMBlG2cP/ JDj4P2vrQmVFjfFy+wqibEVscwDHu4EKh/SCBABqRv2k09nH9ZZqBGZtGCIS0n3T0nPG lHJfj9R4wRfetfZsKoUA1seqVL2jku4DARM7drSxOwZYuWRecQr6ta94+GNuEYyk7DrO s61w== X-Gm-Message-State: AOAM533+CXKAQxFs21m+U0a13vv0XHNIc5o6tEUPVnc2AoZCblDRQgf7 zD6fnjHzl5TfOfn80I0udJEqPAIqm3g= X-Google-Smtp-Source: ABdhPJzsnFSXjCQ/A2X5lTZtyLoR1INqfhEejnlzI3BEuJDl2VG6uceYAMP2yvAA0S/60kqwXzJJqg== X-Received: by 2002:a63:a4d:0:b0:3db:7de7:58b0 with SMTP id z13-20020a630a4d000000b003db7de758b0mr16468131pgk.128.1652722429303; Mon, 16 May 2022 10:33:49 -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 m15-20020a170902bb8f00b0015e8d4eb25bsm7304193pls.165.2022.05.16.10.33.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 May 2022 10:33:48 -0700 (PDT) In-Reply-To: <87o7zxfzfs.fsf@gnus.org> 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:232406 Archived-At: On 5/16/2022 5:13 AM, Lars Ingebrigtsen wrote: > Jim Porter writes: > >> Also, for the code posted in the original message, I'm not sure the >> changes to `eshell-parse-command' are needed. It should already let >> you pass a command string to it. Maybe this is because there's an >> issue with how `eshell-parse-command' temporarily inserts COMMAND into >> the buffer (see the FIXME comment in the code in the original >> message)? If there is, we'd probably have to think quite a bit more >> about how to resolve it. > > Yes, if I understood correctly, that was the main problem -- inserting > things into the buffer to eval it sometimes leaves artefacts (or doesn't > work), so it'd be better to talk directly to the underlying shell to get > things evalled. I think for talking to Eshell itself, inserting things into the buffer (temporarily) should be ok. Eshell already does this (as of Emacs 29, I think) when parsing some complex commands. If you have some $-expansions inside double-quotes, e.g. 'echo "${echo \"hi there\"}"', Eshell temporarily inserts 'echo "hi there"' into the buffer to parse it, and then removes it before proceeding. For sending input to a child process being run inside Eshell, we wouldn't do all this, since Eshell wouldn't be treating the input as an Eshell command to be parsed. In that case, we could just send the string to the child process directly (possibly with some extra Eshell bookkeeping).