From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3312 invoked from network); 9 Nov 2023 05:14:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Nov 2023 05:14:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1699506848; b=NnTTaLVwQ6jyiq/iPAH+sR6Q3SzXk+rwaOAkEZcxZqS1UWl7zUI8LlRkS/62x1csFRkeSurW6d TDHYsXSMekCvf7uhesuJN6t9Nf3HxWjygnWsR+m1sDXknJnKS7mgoU1YbgCoqRS7r1zvQcfawI bis/U2zDleYoUScB5/ZRpIcbk3dlWiT9YBVDUFoUJRRG3QDDiJ0cv5y90aIrRWMyWPXvszNXAM KzeZxjkFrDR3Rdc2X0BBk2a9CcyFb9FNrfbb0OxYV+atVIVFyi8PV9vYQqlie9lnBTKqBy/phX cGxHD/JAZgCgUF/TATrxBIVsan34MjUEXgO23hrTHyUqpw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f53.google.com) smtp.remote-ip=209.85.218.53; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1699506848; bh=K9JXuUoj5EwmgjMCu+OFW9aY0GxA1JD4EoLNFI9YQYs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Rn0bOiMnuGs5gpnP1QGl1zCsOsCgNPvqVKoZIPd52+8P+XRikDpcZ0WCE955/LPF1WvVPEML7b RLdvtMXCrOYp9BVlgb4ZBBOliFAIZb3yQ+vvOjVs38ZNHjbBltRmYyHF6qRDaPipf70fLvTFRt btQ+CxHBSEt9foa7lCALyBblL8GuQHupskS8CUd24jKNSRsmOy3+cdBmQAKvCHMyjvozjacQNv 2TCGYphFWi2wt/B5fGcjOMEe2Y8degjYBPUm3TYMI+WzHZ3mXZDv+0VpFUO2elLHiaUwJpWywG u20CS86O5/jKbpZPxSoE5j1Co4mfs7x38xoWguP2CfZEUw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=D4ZgqnJzIMjprjMieB77Igfms5G5U2966aPpYT6TRqM=; b=j6QYjXjHsaBetnK2v37o5mvn8M EUIlVuZfXKE7B9UQrHg2L43wg7iH5UCtGEgXvTZB3vpyZ/N7UwV5XYI4WfWrl4y8kjizuWBvgGOov hjLV+U5zbEC/rPnXyoG2bUPniGFTVmhfw/ceMVkBlSDaWT+WD2RKmiNFJhLJNW/JrLt5FHhWyJxLR isvNcLKycQU+YxKdEPgeDAS1Jx0lEiOQdA94isSqEZXN/8L+q4zOrlCYcnlRX55oVR4fpFMfLfMiM pZ4sAu3W402L2zz8D1g1fzbdIvMPyFLGYmpjWeMoM0fZWdlvglu/wf2ph69vHUmpeXs3dHLz9V4DZ rjvsiaag==; Received: by zero.zsh.org with local id 1r0xMk-0002iK-VE; Thu, 09 Nov 2023 05:14:06 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f53.google.com) smtp.remote-ip=209.85.218.53; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f53.google.com ([209.85.218.53]:42329) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1r0xMB-0002Q2-S2; Thu, 09 Nov 2023 05:13:32 +0000 Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-9c603e2354fso97879466b.1 for ; Wed, 08 Nov 2023 21:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1699506811; x=1700111611; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=D4ZgqnJzIMjprjMieB77Igfms5G5U2966aPpYT6TRqM=; b=F2o1SB+ccMQitFbP2n9j+anxycLLFV0KMgvNHPzcuc6p2DlUEI5rjRYLJYpmmVdhDb LvaS1osnucPA/4QSb4SqU4oLtGZ+u04IDLrDWM9kjqMcB/3zFBkR3huGBT6xDA+rxDFo c79cVyubqY07B60qrgght6qGO7y+7qcIfQ9SaGuYTEeSGkHffwWI10OQOI7nI+C7R+D5 hMKprcazvVA7YiJi0gVutFrIs7isXnwIDhngH4bzM8Lx2/NtHQd/zLQ5Ow5nzuq6/2AE v4AdGzKjslQ8GKXs+EGgRVhjKmC96EVMPRxpc9bdH7vMCJQoc8qdEUuVLnW3U+VUv1hl cZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699506811; x=1700111611; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D4ZgqnJzIMjprjMieB77Igfms5G5U2966aPpYT6TRqM=; b=HPYMD69Uq7NsDADVmurdVyJeFdcya7ZhqvJSKMwDRSVuoq3HZJY0oPf1zq+IerG/Bw UaVaZ4dDmXjyycf9Zlao591X5iLpSQYNN+Iw1BAUhxD3Dcuh1jAEbmS9Z4/cFys/GOTD v8GnDV4BCZYYud5V23WZIrtPUSDAN+bqauWcafgE4b5q+u7WRv2gOCGw0FpV3zT2mS3E pkMajefhFIWoMPppoJ89Xb/TBl3PAY/LDVgsAxOPEYNWDsG3xpB+4gVCvxGUAEUe0cUK Zao7WRUQdkEkXFgZheC4iBo18FusHiuRk35TnW6DihYG04EUpIEA37FEoWx2U89i5pwc V/6w== X-Gm-Message-State: AOJu0YzxdCzA+V3Uno+V7g4lTnJ2FX96rQ/EFY4rtnabYURGIjs559W6 OrQooQkltvkxtnwddPJFezLOvLBKF4ctzeuAA1o1sA== X-Google-Smtp-Source: AGHT+IHAd6BgVNmwt6oXJVyzxojXkCYXZYndH3Pd5+bgyP2kCI40oKeoWhNDzmbCArV+M4fnQE57qT4SCHoRvqGbXcs= X-Received: by 2002:a17:906:5a56:b0:9e5:2b00:506f with SMTP id my22-20020a1709065a5600b009e52b00506fmr97872ejc.15.1699506810644; Wed, 08 Nov 2023 21:13:30 -0800 (PST) MIME-Version: 1.0 References: <509022a0-b851-4203-bf83-7d6e26660b82@app.fastmail.com> In-Reply-To: From: Bart Schaefer Date: Wed, 8 Nov 2023 21:13:19 -0800 Message-ID: Subject: Re: PATCH: custom zsh hooks (was Re: Extending zsh hooks) To: gsslist+zshdev@anthropohedron.net, zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52285 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Wed, Nov 8, 2023 at 11:17=E2=80=AFAM Gregory Seidman wrote: > > My one-line-plus-documentation patch is below. The proposal is to > have a way to add custom hook types to be managed with add-zsh-hook. The doc paragraph preceding the one you edited says: Several functions ... are automatically called at specific points during shell execution. This patch would introduce a new reserved parameter name; the arrays thereby managed are obviously not related to any other automatically-called function; and extending the list of hook names in this way introduces the possibility of name conflicts with actual new hook functions that might be added in the future. I think we need some more justification for why this should be enshrined in the official sources, and for why it should overload add-zsh-hook rather than be its own new function. The options-parsing part of add-zsh-hook is already duplicated in add-zle-hook-widget, so either there's no issue with duplicating it again, or it's a candidate for being pulled out into its own function and then called from both of those and a third new one (or just rewritten using zparseopts, since getopts/OPTIND handling is a bit iffy [cf. README for changes 5.8.1 to 5.9]). If a new function is introduced, I would suggest basing it on add-zle-hook-widget rather than on add-zsh-hook, because add-zle-hook-widget uses zstyle rather than array parameters and thereby doesn't clutter the parameter namespace. (That assumes you want something mostly backward compatible, because going forward this could all use namespaces.)