From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6407 invoked from network); 13 Feb 2023 21:00:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Feb 2023 21:00:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1676322017; b=p7+EsH6f1ISONpL1DALQPlGsK7vHNLb2wmQomX4E9AquDX/5i8r2dU0GNDzUVciAcD1g2/qyHD BjL0WbRFCnQvfNPgci6EkfeFcQTUomW3CqmsRzoiwGefReMtLzOwB++MTJy0QuqfvM8R7CPSrC Y6vtAXHu5HSjU8gHdfPiDa/8U8N1wbvFx8MdXcmVEVR+epLQJzPvk2Faw0dI7XDGwzzckV3HTK 9QG/nALSk+nIKeWX5eIxMQopwJ1ooMMP7FMBXRhX5pA2U40ByO+TKa7TSt3gfUxiFNUdQ49iGv WycKRKJjr5SpRUFeKvYuRligY0gmDDT2UevQXzAmrswKpA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qt1-f181.google.com) smtp.remote-ip=209.85.160.181; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1676322017; bh=4obkpjjluVEppBDMlI013tsWjDyzGFUuZOa4NuPKPoE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=M4pE8lElLiFulILdWZOoSSOcZvN8hP5K56A6fDgv4XS/PGy4dqUD9nvhVbt2XvcvrglST+8EIH /zict9+kz9DrAjSDyr6eekFVAO93NidFt/BBqTeosTfp++gEr8Z9dSTSTjAECAFN/8sxTSHtAO M/eapQcZgZ6Kvzz6BA/Q9RHWwm4d4woNJ/VVIkauJK5t6oKtH5hgu+BlP7z8bOxb4AqIo2JuR0 Z1Z1SOS6dC5uoXiIijHfWTdjhGsV5P10nQEVVRDXpBu1YOpm3ukOHkFMnZp2wJlwh/thuy3eau CQchhO3CCw7wUwF5hU7gapaNRvxWSwbV9Qq/qjq41c465Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=hTqVTyZVJL+v0mcFlCy8Ey7jzCmk3PBnB3Biaz5K0wY=; b=gjWPxW+vfocP0iNb1Xk4oLPpze lgZ9YCRMkHyr7OxQn2Pf09HqH/jG+PJ2nl6PavBcTftLfbj8sjragsDT8oSpQXX1boGjoIKW2Kx5b ABM+5j9WGoG9fDETrQf69ruE5SnlH3vi9sPSjexNRKDAVtFMuJ/UrzilONY9U/viVibyB6i/28LYz 8uVDRz9lEuJzVU7XhcdKz4+qbZ2dVVKMtlkaxrNciOUT3p805dkfMR1ZP4Io+Lvkx9YvDASRUF68u ulz//9Yv5Q/Baef5DAT7ZZajd7ilYQo5FFPYTpa/mMfD2YI2f9mh+Clj3sG0t98HclWo+yW32QCo2 WBIxrVTw==; Received: by zero.zsh.org with local id 1pRfvs-0004HZ-Au; Mon, 13 Feb 2023 21:00:16 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qt1-f181.google.com) smtp.remote-ip=209.85.160.181; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qt1-f181.google.com ([209.85.160.181]:40523) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pRfvX-0003wK-UF; Mon, 13 Feb 2023 20:59:56 +0000 Received: by mail-qt1-f181.google.com with SMTP id w3so15334004qts.7 for ; Mon, 13 Feb 2023 12:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hTqVTyZVJL+v0mcFlCy8Ey7jzCmk3PBnB3Biaz5K0wY=; b=BsEYB2G/R9WXXtYW+gqTcTidNJ25kme7Q/W4xGwrLJ90LF4M2tmbLFMWCzAtSDDtP0 W9i7qMxEJHoKWbTahjpOHRo70rOT4MhF4wJpU5IlHwOleU3GbgNr3B5hEOqgZTMNTBh1 WZQogIPZxOfxSwsgWOPIllNpFZeE8zOejAes/U5TmrSefMoCJL5KtYK1FB2UmRsSugnN 2vzhi6WFPmznZPoxaluh6hbe//EERpCVOqDFv4xwpvPVndvTAhJQbPhBcGDmquzG55NC Eac+OP6Z6XsWvu9whbO0XqYAtkGEvFzv35ngAPUwIoER15e0qppf/Nluj5p7b8xqBG/K b07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hTqVTyZVJL+v0mcFlCy8Ey7jzCmk3PBnB3Biaz5K0wY=; b=Vz2iYGFuJqVjfGj3GqeVPpIUcICpQLthO9DnBz8D0sS8b40uQER/UtZXyG/OX6qnK5 HC7mLoxfMGeE1zMmLS9SFcNW+2oqEaaH3T+42PePo/JYDliFHby6qbQ4HXCUV9Pqfao9 WrW1//FgXgclL8mUAdlV1Av/K7JGNQDBvksJqgOY2yoTTgMzdXFor54U5TFWTwbL6oBx uWyCdz3yvEpSKBNN2qNcp69KUPKN0afqYkDJYUr6MJ0Qdr0tFEWIRlBnKdfLZN5rjEvw C3kIqeGMOF+fTFqV6dXbWmoIuo0l/p8/vYHcNMKqGErrJN2G+OHwAv/OaPpuaF6lM1XB rifA== X-Gm-Message-State: AO0yUKU+rwiITC0o9suDqynfRtUXTOb5VEOnRdtVGJJoUmUim9Q4xcZb fOBhMpxacNOSqAGe3e71A8AmmpJdSpuIEHS/Rqw= X-Google-Smtp-Source: AK7set+nW2A1ouXgDQ4ljvWZgLnAHgIER5rLipBNcdWAwCU5kdtsdOxw9Xuad0vWJH24VdfrSqmSTok7NZ27saz8c7o= X-Received: by 2002:ac8:5750:0:b0:3b7:fa2f:1bfe with SMTP id 16-20020ac85750000000b003b7fa2f1bfemr3160064qtx.138.1676321994782; Mon, 13 Feb 2023 12:59:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Kalm=C3=A1r_Gergely?= Date: Mon, 13 Feb 2023 21:59:44 +0100 Message-ID: Subject: Re: --init-file option To: Roman Perepelitsa Cc: Bart Schaefer , zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="000000000000073c1e05f49b2186" X-Seq: 51428 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000073c1e05f49b2186 Content-Type: text/plain; charset="UTF-8" Yes, I could do something similar as what zshi does, but that seems like a suboptimal solution, because it would require a duplication (and indefinite maintenance) of the startup file processing logic in an independent codebase. As the logic is not trivial and has some potential pitfalls as well, it seems to me that implementing the option within Zsh would be the most sound (and perhaps simplest) solution from an engineering and long-term maintenance perspective. On Mon, Feb 13, 2023 at 9:34 PM Roman Perepelitsa < roman.perepelitsa@gmail.com> wrote: > On Mon, Feb 13, 2023 at 9:29 PM Bart Schaefer > wrote: > > > > Create a directory "virtualenv" with the appropriate configuration in > > virtualenv/{.zshenv,.zshrc,.zprofile,.zlogin} and use > > env ZDOTDIR=virtualenv zsh ... > > > > most likely you want virtualenv/.zshrc to be "source $HOME/.zshrc ; > > source xxx" and everything else to merely source the corresponding > > $HOME file. > > > > Adjust for absolute paths as needed. A bit of extra work required if > > you want to preserve an existing $ZDOTDIR before replacing it. > > zshi essentially automates this process. It also takes some care of > restoring `ZDOTDIR` before sourcing the real user rc files and > checking `[[ -o rcs ]]` afterwards. There is still one thing that > breaks when using zshi (or doing the same thing manually): global rc > files see the wrong `ZDOTDIR`. > > Roman. > --000000000000073c1e05f49b2186 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes, I could do something similar as what zshi does, but t= hat seems like a suboptimal solution, because it would require a duplicatio= n (and indefinite maintenance) of the startup file processing logic in an i= ndependent codebase. As the logic is not trivial and has some potential pit= falls as well, it seems to me that implementing the option within Zsh would= be the most sound (and perhaps simplest) solution from an engineering and = long-term maintenance perspective.

On Mon, Feb 13, 2023 at 9:34 PM Roman Per= epelitsa <roman.perepelit= sa@gmail.com> wrote:
On Mon, Feb 13, 2023 at 9:29 PM Bart Schaefer <schaefer@brasslantern.com= > wrote:
>
> Create a directory "virtualenv" with the appropriate configu= ration in
> virtualenv/{.zshenv,.zshrc,.zprofile,.zlogin} and use
>=C2=A0 =C2=A0env ZDOTDIR=3Dvirtualenv zsh ...
>
> most likely you want virtualenv/.zshrc to be "source $HOME/.zshrc= ;
> source xxx" and everything else to merely source the correspondin= g
> $HOME file.
>
> Adjust for absolute paths as needed.=C2=A0 A bit of extra work require= d if
> you want to preserve an existing $ZDOTDIR before replacing it.

zshi essentially automates this process. It also takes some care of
restoring `ZDOTDIR` before sourcing the real user rc files and
checking `[[ -o rcs ]]` afterwards. There is still one thing that
breaks when using zshi (or doing the same thing manually): global rc
files see the wrong `ZDOTDIR`.

Roman.
--000000000000073c1e05f49b2186--