From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bastian Beischer Newsgroups: gmane.emacs.help Subject: Re: emacs doesn't inherit PATH from environment Date: Wed, 14 Feb 2018 20:19:24 +0100 Message-ID: References: <864lmkhff0.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1518635925 5464 195.159.176.226 (14 Feb 2018 19:18:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Feb 2018 19:18:45 +0000 (UTC) Cc: Help-Gnu-Emacs To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 14 20:18:41 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em2ZX-0000HH-4O for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Feb 2018 20:18:27 +0100 Original-Received: from localhost ([::1]:51519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em2bY-0000D0-Oi for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Feb 2018 14:20:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1em2aW-0000Ag-C1 for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 14:19:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1em2aU-0004nE-Vb for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 14:19:28 -0500 Original-Received: from mail-yw0-x22b.google.com ([2607:f8b0:4002:c05::22b]:46427) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1em2aU-0004n4-QY for help-gnu-emacs@gnu.org; Wed, 14 Feb 2018 14:19:26 -0500 Original-Received: by mail-yw0-x22b.google.com with SMTP id w142so971963ywg.13 for ; Wed, 14 Feb 2018 11:19:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=m1Azpy8r1LJUfRTdb3SFlJZov7K6Cm45mhHl6BneDZM=; b=XqrDqrXoapzvz21202wnhQaE2i7R1IZvoWm1imXLjrCWamx/kJrlx9qtj0YiIZIYiY 3wzizyTFAIkvVcZ7FqC196uvARsBehRBDhT4Mxqh/T1wEidXzkIQwahBkAka7exf2UsU bSh8s01b1gHP86sSVwV6m9MCz7ZImKmN4A0jd9oue7UbmlI1g3qoASL9IKcmxe+Yvh3a wzBhnVK/ACZ7LmAyCkjXuIGA3o413xZK/KWltliw7mjKxuRe7wlAyso4gQqEq4zJOX6h 6Qd0cXMGOh/XkZoHOzF6g47EtZp+eVtxWVnaepAsxvyBafJfpZWFLlrjPzfylmXZmwFt kf9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=m1Azpy8r1LJUfRTdb3SFlJZov7K6Cm45mhHl6BneDZM=; b=bgiaDxpNceim5Eu2lx52TuNi84Bu8ccUJXQ1Y/VWEU8OMiLigvZZIvzhsWPOvzromw u2LtuQHeM7qxPYCqS/KNKwwg0FnpA4fSDzJAgANDGEOrgtvzIlDZJYXnFja7k5PlBykz 98cg8z5URYPX5ree7SRCm9LZIN/oi6VbDPLVZdJKHTOA8wS7ynN3jlhNUUMzJDykF06+ B32IfT9oclv/WXAv4aK1DUnMoFpaTMxfF0OxToAY2gwjGwtIuBkYm4KLtOfSTXcs3Zh7 FZ7XqC2ZCHsor7upxWDVrm4q0qbsrkkADwxvmdxG3ZgV7SPougqLV/ZGlmK7+RTXzYuP EFUw== X-Gm-Message-State: APf1xPD5jAZKDJRvXcw4ygFyCOPOnQEzrwKYzoVwHuZx5U+3cICXA/nv 9OOb4sBKXfCcH58WP5bn8ntLAYPC6m/81nQu5h8= X-Google-Smtp-Source: AH8x226jRRGFsszA+SHct/94rrJzqSPPqoeyEU4nfZ2QS8j4cI6LUIDDIEEVTqOsRlDG7gLQYDoH7z/03/ohtmAZ/gs= X-Received: by 10.129.71.68 with SMTP id u65mr253313ywa.192.1518635965949; Wed, 14 Feb 2018 11:19:25 -0800 (PST) Original-Received: by 10.129.156.21 with HTTP; Wed, 14 Feb 2018 11:19:24 -0800 (PST) In-Reply-To: <864lmkhff0.fsf@zoho.com> X-Google-Sender-Auth: VHk2OSZ9amHSR_kD4Hshr84AlLk X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c05::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116008 Archived-At: Hello Emanuel, On Tue, Feb 13, 2018 at 8:12 PM, Emanuel Berg wrote: > > Larry Evans wrote: > > > When executing a Makefile or invoking eshell, > > the PATH is not the same as when running from > > a terminal window. Even when I modify the > > PATH in the emacs initialization code in > > ~/emacs.d/init.common.el, the executables in > > the PATH are *not* found. > > Where and how do you set PATH? > > Shell stuff that I want available from Emacs > I have to set in a special file for zsh, which > is > > ~/.zshenv > > If I put the same thing in plain .zshrc or > a file loaded from there, it doesn't work! > > I never understood why because the Emacs > instance is run from a zsh shell, but for some > reason Emacs cannot see zsh stuff that aren't > defined in that special file, even when (as > said) executed from a point which HAS access to > it all! > > My experience with this has only been > *functions*, not environmentals, but it is > worth a shot. There is a key difference between functions and variables. In zsh functions are not exported to subshells (except for (...) subshells), unlike exported variables. In bash you can mark functions with 'typeset -fx' to propagate them to subshells, but I think with zsh that's not possible and you need to redefine them in a shell startup file which is read when the subshell is spawned. Typically these subshells are 'interactive non-login' shells so possible places are ~/.zshrc and ~/.zshenv, but not ~/.zprofile. ~/.zshenv is always read, also in non-interactive scripts, which is why I don't like to use it. It is also possible to place the code for the function in a separate file in $FPATH and use autoloads, but even that does not work without the autoload line in ~/.zshrc or ~/.zshenv for subshells. For variables none of this should matter: As long as the variable is exported it should be visible in the subshell. However, I don't think 'eshell' is a real shell, so that may be a different story. > > Also, you can use this to check the value prior > to starting the shell and Makefile compilation > session: > > (getenv "PATH") > > Is it correct? > > -- > underground experts united > http://user.it.uu.se/~embe8573