Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
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 <d.s@daniel.shahaf.name>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
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>
 <CAH+w=7YYkto7u1WNcfmTs30o1wVGF4VRwnKmJtFz=5K4iLLp5A@mail.gmail.com>
 <20160513222039.GA2425@tarsus.local2>
 <CAHYJk3S9qPhCByg8T-mrRjgUNBs-ubFCGKDKT7qx9=yGepA8qg@mail.gmail.com>
 <20160514030031.GA2530@tarsus.local2>
 <CAH+w=7aAtxrpcXg8nyGUE1mB1ifczMU1L13g7nqcoMp2f68LYg@mail.gmail.com>
 <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)
X-Seq: zsh-workers 38647

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
>     }

