From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4459 invoked by alias); 28 Aug 2015 16:29:26 -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: 36316 Received: (qmail 20393 invoked from network); 28 Aug 2015 16:29:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:cc:mime-version:content-type; bh=OcPmWUfgTE6nsexXby0tej3G2qALOBPQc8lqLzm9T6s=; b=UfdJFxOh/blFmhZLXvSCQuKBud/EiX2qmud0FJjIGhfC7EEnc8zhdnIUU5bqvuGRyJ F5pfPrmrYaXc+gsDHgsiMyKZpnkYInW/YJH9MmkNMFXtO71mySMQqcITG7d9TMccHpux 9lxA1a4vtRPhqxvMuuTnCFefnrZffFtH6SHZbJz+/uCWnIfgxQRaqA4wtloW+p4PRLmn i0GcXyr7O2T4PiKDY55KTTOrIA7YYawNBTzwuo9JwBZK8n+yg4mb4eZ+NYnk0jnDq0fp V7aT+enFzit/IN60xWV2EUTEMFQVnH7oQYNXLPbwwbpvNmcpzsi9HKMx4P7/RXKxoUN1 Qk2w== X-Gm-Message-State: ALoCoQl5dJ6vwn6AFuT/+EOw305KZfqE+NkhOPgnorDwXvbXRwbmgk2ENT8mxR5Icanq9qU2uRLh X-Received: by 10.60.177.33 with SMTP id cn1mr2171548oec.82.1440779361806; Fri, 28 Aug 2015 09:29:21 -0700 (PDT) From: Bart Schaefer Message-Id: <150828092917.ZM6880@torch.brasslantern.com> Date: Fri, 28 Aug 2015 09:29:17 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: Zsh will not parse an autoload function when it has short loops" (Aug 28, 8:43am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: Zsh will not parse an autoload function when it has short loops Cc: Mikael Magnusson , Sebastian Gniazdowski MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 28, 8:43am, Mikael Magnusson wrote: } Subject: Re: Zsh will not parse an autoload function when it has short loo } } On Fri, Aug 28, 2015 at 8:39 AM, Sebastian Gniazdowski } wrote: } > Hello } > } > I've created autoload function "bug" in /usr/share/zsh/.../functions, and } > when run, it gives: } > } > bug:9: parse error near `list[$i]' } } This is expected, the shortloops option affects parsing of files. There's a straightforward workaround for this: Instead of autoload shortloopfn use emulate zsh -c 'autoload shortloopfn' then zsh emulation scope will be in effect when the function is called, and everything will parse as expected during loading. However, it appears "autoload +X" does not respect the emulation options put into effect at the time the function was originally marked for autoloading. I can't decide whether that is a bug. The reason that the "autoload -c" trick works is because the function ends up being defined approximately as shortloopfn() { emulate zsh # "sticky emulation" autoload -X shortloopfn } so the emulation is restored before the load, and obviously this is not equivalent to "autoload +X" run explicitly. -- Barton E. Schaefer