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#57370: 28.1; eshell/addpath does not work when called noninteractively Date: Tue, 23 Aug 2022 17:16:33 -0700 Message-ID: <3554adec-a5b3-b345-ff75-cf798654c0db@gmail.com> References: 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="11673"; mail-complaints-to="usenet@ciao.gmane.io" To: Colton Lewis , 57370@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 24 02:17:11 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 1oQe51-0002or-8C for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Aug 2022 02:17:11 +0200 Original-Received: from localhost ([::1]:39732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQe50-00071E-5P for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Aug 2022 20:17:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQe4s-000714-TI for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 20:17:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQe4s-0002Rg-Kk for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 20:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQe4s-00075R-4c for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 20:17: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: Wed, 24 Aug 2022 00:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57370 X-GNU-PR-Package: emacs Original-Received: via spool by 57370-submit@debbugs.gnu.org id=B57370.166130020327213 (code B ref 57370); Wed, 24 Aug 2022 00:17:02 +0000 Original-Received: (at 57370) by debbugs.gnu.org; 24 Aug 2022 00:16:43 +0000 Original-Received: from localhost ([127.0.0.1]:45268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQe4Z-00074q-07 for submit@debbugs.gnu.org; Tue, 23 Aug 2022 20:16:43 -0400 Original-Received: from mail-pg1-f169.google.com ([209.85.215.169]:44748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQe4W-00074d-Ku for 57370@debbugs.gnu.org; Tue, 23 Aug 2022 20:16:41 -0400 Original-Received: by mail-pg1-f169.google.com with SMTP id c24so13607300pgg.11 for <57370@debbugs.gnu.org>; Tue, 23 Aug 2022 17:16:40 -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:to:subject:from:to:cc; bh=nbTnkZ60sYLAW4Td3jZA5Bm7H6ZBc5BZS5/d5PTIc1Q=; b=I5cOSJYgcyHoMC/hDRxPtyw6XzTIUoI+pasqrD2NvFNSEZHI289bxrofdW51cOHwna HvhQXZPkY1+0Vau1yRBgaBSqB6+W9cCWMd4Ty3dWvBu4b6plZKQyrUNHpj46Ek3Ns3pD pBenKnNzF0KBMshM4YNLRceedG6hL4ae7SCUm5nhMnZJ79SnebeP4xhYlsjgcdITSTsU xT15UaIVatfuXnAW2CMfab1BtGqvKyOEKSosKT71wzhNYVGJjpxvsQAp9BF7ObOkYicO Y4YQhM/hu1PSfhvqMosMlDsBmxzjcO6VHgnVy7EIOjOItAF8YM9BPPtTVjLb/qVtifom 0qMA== 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:to:subject:x-gm-message-state:from :to:cc; bh=nbTnkZ60sYLAW4Td3jZA5Bm7H6ZBc5BZS5/d5PTIc1Q=; b=STpnQoOralaNBT/aB2udHS8xcQdo2vlF9ui97ArCO3GX1sNbRGQx6PJWZAcDTIXrbp i2ctLBvP5pIHJQ4CnmuvkzbzNwcDj2+IKXCuxSlU/XSHD/ftXXS2IqS2NPkjuTp/CvYF 4YLYImnGno2ZmMinczl/5Tp2vp+TwGtg+235Bv5vi34kxauF6Q5TTbz9RsjZQ8vl3yQW 4k/aiwjxper5MzmrXVnH+pi37uIlHnuUDdscu9hdbR/2mpnyB76nRkSzw4qnQiQnne6a bxEKxFVGl4SxdpGKsKfT5DuK6kd0wktThn4m+x5WpcbxRQzpOdODWUMyncgbdMYhNFsc f7Jw== X-Gm-Message-State: ACgBeo37zhK6N5KuBFBbzPjruKOSw4+NFO5/wM4xOBrwwouLDAygNHgm keOkN+PY+ll2Es/dPtkRbr4tSOJunfk= X-Google-Smtp-Source: AA6agR5ta0Hr6VhZn5gvtVFAC7BRS2Q+4sxnPDJ+xGciMBQlfxbPGaUbNaLGT7vVvOoK2AgE+AIkFg== X-Received: by 2002:a63:4b65:0:b0:42a:a707:17a5 with SMTP id k37-20020a634b65000000b0042aa70717a5mr10721965pgl.137.1661300194708; Tue, 23 Aug 2022 17:16:34 -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 x3-20020a170902a38300b0016f154c8910sm11102485pla.204.2022.08.23.17.16.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 17:16:34 -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:240581 Archived-At: On 8/23/2022 1:36 PM, Colton Lewis via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Discovered this trying to add a path from my init file and I just could > not make it work. > > 1. Create an executable script ~/test-bin/test.sh > 2. emacs -Q > 3. Eval the elisp snippet `(require 'eshell) (eshell/addpath "~/test-bin")` > 4. Start eshell > 5. test.sh > 6. Observe command not found error > > Substituting `(eshell/addpath (file-truename "~/test-bin"))` gives the same > problem. > > This should have the same effect as starting eshell immediately and > executing `addpath ~/test-bin`, which has the expected result. I can't speak to the other issues you mentioned in this bug, but I wouldn't expect calls to any 'eshell/FOO' function to work outside of an Eshell prompt. Many of them assume the presence of various local/internal Eshell variables, so they wouldn't work if you called them from a different context. To run some Eshell command, you could use 'eshell-command' or 'eshell-command-result', as in: (eshell-command-result "echo hi there") => ("hi" "there") However, that's not useful for calling 'eshell/addpath', since Eshell buffers have their own local 'process-environment'. You'd just be updating PATH in a temporary Eshell buffer, and then it'd go away immediately when the buffer is closed. > The only workaround I've found is to modify PATH directly with setenv > and getenv. I think that's the best method. You could probably do it via 'eshell-mode-hook' if you wanted to change the PATH only for Eshell.