From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24161 invoked by alias); 10 Jun 2016 17:42:49 -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: 38647 Received: (qmail 23125 invoked from network); 10 Jun 2016 17:42:48 -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 autolearn=ham autolearn_force=no version=3.4.1 Date: Fri, 10 Jun 2016 17:36:06 +0000 From: Daniel Shahaf To: Bart Schaefer Cc: Zsh hackers list Subject: Re: zle hook conventions (was Re: bracket-paste-magic ...) Message-ID: <20160610173606.GA13215@tarsus.local2> References: <20160510085833.GA20332@cventin.lip.ens-lyon.fr> <160510125848.ZM1686@torch.brasslantern.com> <20160513092348.GB18186@zira.vinc17.org> <20160513222039.GA2425@tarsus.local2> <20160514030031.GA2530@tarsus.local2> <20160519211458.GD8007@tarsus.local2> <160602000600.ZM14708@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160602000600.ZM14708@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Thu, Jun 02, 2016 at 00:06:00 -0700: > Crudely sketched, I'm thinking of something like this: Do you plan to take this further, i.e., to polish it and commit it? It would be a useful interface to have... Cheers, Daniel > add-zle-hook-function() { > local -aU extant_hooks > local hook="$1" > shift > zstyle -g extant_hooks "$hook" functions > extant_hooks+=("$@") > zstyle -- "$hook" functions "${extant_hooks[@]}" > if [[ -z "${widgets[$hook]}" ]]; then > zle -N $hook > fi > } > > add-zle-hook-widget() { > local -aU extant_hooks > local hook="$1" > shift > zstyle -g extant_hooks "$hook" widgets > extant_hooks+=("$@") > zstyle -- "$hook" widgets "${extant_hooks[@]}" > if [[ -z "${widgets[$hook]}" ]]; then > zle -N $hook > fi > }