From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28200 invoked by alias); 23 Jan 2016 19:19:34 -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: 37746 Received: (qmail 20894 invoked from network); 23 Jan 2016 19:19:32 -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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=/kEz59vTVhf6CBL5MtdhoGXO+XuXxYLjObny6jM0RaE=; b=ml6b8cXgknL9aJ1Ofut3nj1Ws3QmyZewzMzLA4mOqLXTJREw2VR1XyPS8F4mzWN7uu Z+Ewg+KZ8ggp6wpHgaugzXwIKt/pO7cbW+G//mjEn14sOgNWP1EgqZfCs0waUSPXhtvQ 8SpLnkuUNGoWeUs0abRdjXwVVd8G/OFeluV9Jv8K+UAZMszjO6h77tKH5maoWqTTOgyY BwfrReX1YQvxw8puvmt1N4KaijJQDf15Sw7k293jXZ4oAEsqNBsDUub/6Gs3lJrzBPWC tsA8z6tajJOtUaEqjbZ5Tg+TU/yx3gYYgWddvaorwk84HLQCn8niwUWBNL3BjN440Jq9 U6Ug== 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:mime-version:content-type; bh=/kEz59vTVhf6CBL5MtdhoGXO+XuXxYLjObny6jM0RaE=; b=Jdz8yuY8xNyQ8jEZM4aiUDTPIZyuh1xaWpfCX3OV63TRo5BRsNro4zpbf8y8EIZ/Ng t9Vre67KMgG2Ai1K6ZvCeknYy8x0SmWrdxwH429qfjI3jF91HgD/8Sd5+VGA6ns6Vrf1 LvBWDwLAYgtcD3iFGG7qayxLK84lV/FPjMvUJmQSB3PhfVE4H8+/fw4frcA+uqlJl+5U QLnXOMLWDPLPvRLQeLXioOBxkoibZKjgeYp1GLd4+7wx4qaQeepK2vNIjBkjry0zSIr2 WpA7voVQZ8yz+vwYOvo+J+4ObUxxDQuyFIGEWlQVdoesoRIr3gbR99EgCZHHalJ3Y2cf C+lQ== X-Gm-Message-State: AG10YORtYzJBpoiR3RupolSPj+Q2LNcHNNV9AM1Vw2kBeECk9UT0kfjVMrk1dqx/eyD4Zw== X-Received: by 10.66.121.136 with SMTP id lk8mr14044188pab.1.1453576768426; Sat, 23 Jan 2016 11:19:28 -0800 (PST) From: Bart Schaefer Message-Id: <160123112004.ZM14739@torch.brasslantern.com> Date: Sat, 23 Jan 2016 11:20:04 -0800 In-Reply-To: <160123093602.ZM14454@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Proof of concept mainstream plugin manager" (Jan 23, 9:36am) References: <160122173705.ZM11491@torch.brasslantern.com> <160123093602.ZM14454@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: Proof of concept mainstream plugin manager MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jan 23, 9:36am, Bart Schaefer wrote: } } A less pleasing approach to the whole thing is to use "autoload +X" Another possibly is this, though it still doesn't address all potential issues with overly-clever uses of "trap": shadow-autoload() { local -a opts local func # zparseotps doesn't handle the "+" form, sigh; # here as placeholder for something more thorough zparseopts -a opts -D ${(s::):-TUXkmtzw} if (( $opts[(I)-X] )); then print -u2 "builtin autoload required for -X" return 1 fi if (( $opts[(I)-w] )); then builtin autoload $opts "$@" return fi for func; do eval "function $func { unfunction $func local FPATH=${(q)PLUGIN_DIR}"'":${FPATH}"'" autoload $opts $func $func }" done } This seems to fix the problems with your "aload" test case. Some old versions of zsh may have problems with a function that unfunctions itself, but they're probably old enough not to matter.