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=-1.0 required=5.0 tests=DATE_IN_FUTURE_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3188 invoked from network); 28 Jul 2023 22:09:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Jul 2023 22:09:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1690582192; b=GRo8/NET7/mmAi5XEQkh2XMvJtbUR8vFu8XIBL8ejxv6PwgdiNc3AhLwx2mfSHLSrcp5HzGngI 9CFQTEGC5wPMsk/JW6WkzW/cfXyCj1e4yant0gtd2twWsLzbfj9gKh1RVK40gKmmyM88ZoVh/d 4kKQeRrcYCTTSEVujBVb5nDQh/UMVJ1v3AhdegTJry2opxZN32w/xZtkeef8Uozg5Iyssu4nC/ 4bd4lte7+964/WCzjWMgqGkdXz3wG+zMDZmqmh2TZxammfgyNJWjf/se3EP+mGIgsRyMO2foG0 l4LW1aOkerzx1kdrTBsQrDd72442OP2sEc7wevSiEs1p4Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f53.google.com) smtp.remote-ip=209.85.167.53; dkim=pass header.d=gmail.com header.s=20221208 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=1690582192; bh=Xjgti/YOp4Y8baO1pR0/UunNgtzWgkL852ss6IPI8XI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=po2zjNU9o7kMNPkkrxIzitp6ArDb0Q4HXyEx4r/qMbVbWu7a2lbG3h6GBsRHic5phbS5R2DfzK 9c94n4hkZb7ayMyaJypKI/Gl4JIBlPcwFESUbgMf4ZyPpB7pz53qKZAlfj6vu+DXOl62lvuFE9 qid7Ij97cXtyOfXrZUy45bSThIRDvOWUwSM/JtJw3X4tyd3XfARfoE/Ju+vCUEOPYU4F+L8bUl PUW8m6c4vW42MSHZF1CsaxTR3k1RKFE9S/oSEdnF9WO7ECxBhqgA5ByMwDwK03giDCOmPLKfBP MhvB9WRGXGwhRxatIsbKGZa96+35xSH/6AcV3/lFFvudJA==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Qyy0xq3MQlhL+gvoi2awOtApvZ5uWKyof9TxcbotH6c=; b=nL72etqLD+VNEre6RpOlU13gVP D0FzTRih8A1oK/49jCoFOOot27evAaxwopMehMbTuxUBI92DXLgkb6TUeAYbYKqUKVvPI21D0OTAq sgXPlMJxzHZUE9zzuRZjfT31pzx2Jvgkj/mX9DBuXqCLBaroDgJ8pHWHUcNNynCdAt2cnoVN9MKij rj8wWY4M6DjX9xVAEcyXrIE18yPpiy+xF7s3OqWghrzQyVxdzSL+OKfmVtlz7WYOz7PB58Xtmgstl tHZne1zUJNY9ARBYndlQzEw33Glysm2nBb9z59wRcY51q6G1c5SWcdDzU2YdyDemBqbaSRWzhewYh DRCPs4nA==; Received: by zero.zsh.org with local id 1qPVeg-0009mZ-Bt; Fri, 28 Jul 2023 22:09:50 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f53.google.com) smtp.remote-ip=209.85.167.53; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f53.google.com ([209.85.167.53]:53329) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qPVeU-0009TV-Ff; Fri, 28 Jul 2023 22:09:39 +0000 Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4fe0e34f498so4269335e87.2 for ; Fri, 28 Jul 2023 15:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690582177; x=1691186977; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Qyy0xq3MQlhL+gvoi2awOtApvZ5uWKyof9TxcbotH6c=; b=SQMpyzfEO9qRGlVqqLdIrAwvPHLVVGr2WLbJV0mOXJVnIsw7QX8wvL0esLMXbINzpX TxbzyO0fh+u7T0XgBM9f9WjF+gQZU67RfqZLqRunqQXW3yV4EYqQQVjCqcKVZr+m5M5+ Y7YJ799wt0iU5SpcX5jlQz9rnHqgxH4NFm9JbJ2UtbxYbwpkmn16+BgU5gHv7l9T88qf IFjHAf+NzBlD0/RgtetjxA5SspkJpEPe7DKca+I08/fSGsPeZ+GqfGyt5Vx4jbve0rfa 4t0uRYVVLKVuv0FTdUCRSrf6OSKicbZL8MWiC1SzB8FIB4+1p1H8fDJCSnEc4rdHkzon LOtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690582177; x=1691186977; h=content-transfer-encoding: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=Qyy0xq3MQlhL+gvoi2awOtApvZ5uWKyof9TxcbotH6c=; b=IOrPvjaJn0unYKbTlsiOSCUKAcqZ4Ir9puL67F+rUySDm3Oa2aIcWlUNyrtCJsa+SD cBIBTmbwovnFPnQqBySiSo7lhLgV3UWuVTg+nI65k5Cj5qamQ5X3J87MVYWm/yq5+Tpa kj9m0d/vUClJv/JXKyMnWvfdz2pRlJX139WQe0OiwpmjjyGSd3naodg6mperkBlwtrK3 IRd+NcwbgHIkQHfLc8GMuWmx5bBH6bk3QyTFJzzQK61xLRVeXZJeIuXDD8YoG3jNrZ53 IK5thTXNWYdG/0z8aZwn0uMO2Mf1IfQOnvIhI6bOEQ6UUOliJvfltYPls9LvatbLG8Ue 2Y1Q== X-Gm-Message-State: ABy/qLYNnpSxYECHL2Y+h1hyHfijshuPncVk2++VnC95yI9DoHRRlgd5 +kDRJS3KRLtMRSQ9BuAkMNHRCdcj2jsdOyWG4egQzs/3 X-Google-Smtp-Source: APBJJlHw6bdUXDe24v3UaHNqFadrnIxJsQba4eibJUN9Fi0IGveSRNyVup6F/3DlijsmasOKk/d+Fx0Uj04ToSvK3/M= X-Received: by 2002:ac2:5f49:0:b0:4fe:1e69:c379 with SMTP id 9-20020ac25f49000000b004fe1e69c379mr2300914lfz.13.1690582177314; Fri, 28 Jul 2023 15:09:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Fri, 28 Jul 2023 22:09:17 -0500 Message-ID: Subject: Re: Can this snippet be further improved? To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52002 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: On Fri, 28 Jul 2023 at 16:38, Bart Schaefer wro= te: > > On Fri, Jul 28, 2023 at 3:07=E2=80=AFAM Sebastian Gniazdowski > wrote: > > > 0=3D${${ZERO:-${(%):-%x}}:A} > > What is $ZERO ? (I'm not very familiar with the "zsh plugin standard" he= re.) ZERO is a $0-like variable however provided by the plugin manager. If a plugin supports it then it may be easily loaded in an non-standard way, like eval "$( Is there a reason not to use ${funcstack[1]} instead of ${(%):-%x} ? > I presume you're assigning 0=3D at top level of the plugin, otherwise %x > is going to be the file where the function is defined rather than the > file where the function is being executed and further you'd mess up > FUNCTIONARGZERO et al. I suppose %x doesn't require zsh/parameter, is > that really an issue? I think that the returning of origin source file is a plus =E2=80=93 one ca= n throw in the 0=3D"=E2=80=A6" snippet in any kind of file, hash-bang script, sourced script and autoload function and always get expected result. I think that if it'll be called in a function defined inside the sourced script, then it'll still return the same, correct file path. > As to :A vs. :P, it almost seems like :a:P would be preferable to > either of those ... :A is described as ":a followed by realpath() > except where there is no realpath(3)" whereas :P is "LIKE realpath()" > but doesn't actually require realpath(3). Thanks, it seems to clarify the :A and :P difference, I'll go for :P then. --=20 Best regards, Sebastian Gniazdowski