From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2248 invoked by alias); 19 Sep 2012 02:34:55 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30680 Received: (qmail 19324 invoked from network); 19 Sep 2012 02:34:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 389510.9181.bm@omp1008.mail.ird.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1348021726; bh=m3h9Om6WJ3O29n5sDqh7FpIKia52HSGKxPJIeCiNSVA=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ohhi0htgDvEyLDF+L9ZUNaJpLvBHZb+gPfDZoz0XGNEEwka92T/CjPVZpnJ8CWn4ALPUBPYDSc8oidBEKU7m0z2Rzw8XFMcDfwXJQ2sMCo6mzLPD/8AtASh1UK6A8BgfyOQFydxw9MpyMd49Fd19+qRVd0I+ogGph0Z98x0UYSY= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=rCUFUZCN/XiLYRneuboJ2vzdEtm9QF4qb9c4WA2YwACiiuNigE66M9fJXlAPwLlyOicD6IqwpEEYiNLB6uFhZ5viMNLkCtxovXRc455rrJo/JiW8EcYNx7KIM/rMMpqOJXN6jh13G61iA4CFGVynelWgfUmVxgyL6MbU8VhIpcQ=; X-YMail-OSG: 0z8RT6kVM1lbo_UHEZXfjj4Gb2GC7ZLCc_rFBLuOl3mezRb oWmL.6WAATK0z1g.iB_drWTRI.GZMHxN88n9cBUCqn857eJ8SC0tXSwkL.Sx Ey7xuPvxZjXwzmIpfZvzf63erQDFTlzbIpuslcsjx4L25dWmpC0SXOOCuG9r fdlM9AR8rMTTKVqhnIHoWS6F9yL1EIwUoOj2JpjQG5svZZNyzH6Unk458iJ8 hVKzHvvgO568bGqOS1m224JDBCKjff4ozGjLAGqv48KBSHD4Tee4o0iM6chO urg5U05AIeeUeRaNT0g1YbFAx7NJ1RI9DWVY3UNUXD_6X7gIST4lGVOoMSl_ Cbo0zaqhwxQErjGmLL6k0dkRPHvjRS1glGvuYRZ.yZfoWav3EEZzU5jHaAgz 8ycZuIedNp2J9bjKofJsZymDjvt_N77ubWN8vzIW_9rqjjMObMSI- X-Mailer: YahooMailWebService/0.8.121.416 References: <13194.1347934322@thecus.kiddle.eu> <120918095827.ZM23535@torch.brasslantern.com> Message-ID: <1348021726.8764.YahooMailNeo@web29706.mail.ird.yahoo.com> Date: Wed, 19 Sep 2012 03:28:46 +0100 (BST) From: Oliver Kiddle Reply-To: Oliver Kiddle Subject: Re: autoload -X inside an anonymous function To: Zsh workers In-Reply-To: <120918095827.ZM23535@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Bart wrote:=0A=0A> Aside mostly to PWS:=A0 Is there any way to detect that = you are in the=0A> anonymous function?=A0 (!scriptname) means you aren't in= any function at=0A> all, which is what bin_functions() is testing for.=A0 = Using strcmp() is=0A> not ideal, since one actully is permitted to create a= function named=0A> '(anon)' [though it would be ugly/confusing to call it]= .=0A=0AIt might be better to use a named constant for the string "(anon)" s= o=0Athat a pointer comparison can be used instead of strcmp(). Either that= =0Aor add space for flags in the shfunc structure.=0A=0A> IIRC the extra pa= ss of alias expansion was discounted because by the=0A> time you invoke "au= toload -X" you presumably have alreay reached the=0A> function via a name t= hat isn't an alias.=0A=0AIt is a bit of a hack, though. I couldn't see an a= lternative without=0Amaking functions in exec.c non-static.=0A=0A> } While = looking at that relevant bits of code, I also wonder whether=0A> } the seco= nd call to eval_autoload is reachable code: no builtin using=0A> } bin_func= tions allows both the -m and -X options.=0A> =0A> It definitely is not reac= hable because of the test at about line 2686 in=0A> builtin.c -- the second= eval_autoload likely is there for completeness=0A> (in case somebody later= adds a builtin that allows a mass autoload).=0A=0AI would have assumed it = was a cut and paste remnant from when -m was=0Aimplemented. I can't see any= reason why it wouldn't work if you simply=0Aadded -m to the list of option= s accepted by autoload (or -X to=0Afunctions). Not that it'd be especially = useful; even your "autoload -m=0A+X \*" example is perhaps only useful for = checking there's no parse=0Aerrors in any functions.=0A=0AOliver=0A