From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 833 invoked by alias); 9 Jun 2016 17:07:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21635 Received: (qmail 3772 invoked from network); 9 Jun 2016 17:07:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=Zw8U09PYcJwBYhs10ayE//48eGlUocDdIA9tpk0jZn4=; b=NdZu1h/H4CKDyOrbvzl6S9zV+I2NlEuEoEPslXGD7IEEjPZ/4bJ0rSYUsrXvf+6xYx xSWk0HFlHq3T4A+uSR4XuZcsdGOkN33J+dMaxIESIzWCapttyu5MceE6C2fglBpj0Qd4 mZ9Q/eda54bhIiXRjhhVkwqSZzXV9PFcghv9JAESpuPgnL/QdWiQVllD7BrM2rh6eR7H KoDwkUZEffCtCDET34D00kyok3KIphCyOEwVM8kNZMwzaJ8DtV/RPlpNrwuyZOWwRCCD UzTWFFvw6wbe6AiYQqwz8LtJEnTit0DCX1Z5FnvB4QUJGSneGJEqQaOco6xhBBfj6Yll 9ZzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=Zw8U09PYcJwBYhs10ayE//48eGlUocDdIA9tpk0jZn4=; b=Z+VGYmGjsh+CQqXV+CDYuSGIvEu80VrIXnbXz22/M9f4wJpcqwtbuMTSE3JM9vFzBn a85x3Hl9s8gJWI8v8c4nxEq0hrjV6Yej75PCabha1dW9HppGGBgPpmt764GQ/UcT9wZT XTit5/wzhKiX9ZMkw10Ho8x5ZSq0KQj/YXrj4TyEkQb9a0S0sCXLD63LyBY8KUM5xGIR IHG+WyokcDv8SB+sPmEqUXz83Zod0mvBaH4371rSMG880zgTUVGC1JRWn+oYaiv7CVTU E5jfZuhpBF/3BeocLmoDOMj3rSZSkj0wVCfUPOAEjuBR2f2XMB6dwLOrEc3iK0x6WsbL n2VQ== X-Gm-Message-State: ALyK8tJ0yDXYxMWDt96fYsRLBK531R67UhZyru7jx9/XInOj71qaKJqguySPwU6gZnoiWVaHUXaZ117Fam2c0Q== X-Received: by 10.55.99.216 with SMTP id x207mr10852789qkb.163.1465492023696; Thu, 09 Jun 2016 10:07:03 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Sebastian Gniazdowski Date: Thu, 9 Jun 2016 19:06:44 +0200 Message-ID: Subject: Re: Can $_ substitute $0 when nofunctionargzero To: Zsh Users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, documentation says: "The last argument of the previous command. Also, this parameter is set in the environment of every command executed to the full pathname of the command." Turns out it's the first sentence that happens. Last argument to `source' is substituted for $_. But in real word, $_ can still be used when option functionargzero is unset, unless someone will came up with a standard of how plugins can be parametrized =E2=80=93 they're normally sourced without any additional arguments. Any more flaws in this? Best regards, Sebastian Gniazdowski On 9 June 2016 at 18:44, Sebastian Gniazdowski wro= te: > Hello, > this (one line): > mkdir -p pathcomponent; echo 'echo "0: $0, _: $_";' > > pathcomponent/sourceme; setopt nofunctionargzero; source > pathcomponent/sourceme > > outputs: > 0: /bin/zsh, _: pathcomponent/sourceme > > So it looks like $_ can take back what nofunctionargzero takes away: > path to sourced file. Normally $0 is used in many plugins, making them > incompatible with nofunctionargzero. Z-sy-h has an explicit check for > this and does: > > echo "zsh-syntax-highlighting: error: not compatible with > NO_FUNCTION_ARGZERO" >&2 > > Can $_ take over? This would mean such scripts can be compatible with > emulate sh and ksh. > > Best regards, > Sebastian Gniazdowski