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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21446 invoked from network); 23 Jun 2021 20:31:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Jun 2021 20:31:49 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1624480309; b=pCui5fLyvtqF68SBkVOA8ABvJlQlK8dK1M4xl9IU7HSteG4eOEwBf85oXQx/XrjF0dsQFVw0tb th7MWJXtCJN+Tm9iXfZFWFPvWOXPSqAcQOf8KJ+Dk51q2A8hpe1vHDFbPXQGuSNUpCBgdFmpuq KkoQo6cB1do7ugMUeC/c4t0y0kOcYdjOGKOxKqeB/UfwQB5x01dbAvFcpXUe0uokdrvYu+xUj3 wOhAghlDoRjyjOBdcNR0zxLGtm5EjhcGQsDRVpdaVrtweuiq7efmsyBrw1zzF7uiZunzfOy46e bepwIg7gGK42r08o5BVoeVGYMM/6WktNKLoVcY8UWfkIbw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f181.google.com) smtp.remote-ip=209.85.208.181; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1624480309; bh=hd7X7P+PQYNXAoqN76Atehdl/6P26aR5IvMSeheeizQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=VS/Rjo/wws9mCAfxlJWbYSkNGGVISs/lDL2276obRQGytoXZ4frEwoH6FIWizOWmtxB7D/cwLy DafsNrguIrC0w7pqeOWISLakW45hYemAmf38ee2kVqfvWGJzudpWhFtZ4QVPR2Q7NuhPPeuBK5 J5tfi1LeJzBAp80iVdwbuU9oOtT9RvElw2qJbQhOwYm/TKnYB/NsC8l/ZHtpeFjQQHEP/ClWhn //E2nAcaYGbMNrT/pR4IPUiav3Q6zJW79pCM/zBSFubKWdonvcSMACdsL4c+6Ap8wJtbEv9X5G xj22f91BMYXu2kKGOUX8Iuu6rgBGJ6eJpdOZLjA+OlHX2A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=31YiScwljtd4WtGuM2RoJagi2JxOrt7uXAJ/4UdVeiI=; b=NM05c8u6GaH8WFzbpEChGGEO0c ded3u6+Tknvg0F4mURCO03iWSFJx1PXy2L3WrfLE7K3rAOdzdBcRiHElRiMo1/0ZHpovgFXWzT4EN 35Y/k/dQ+4xs2ZkmQl1XNpJcwFcfltcMryDu4j0GZTUNlAjbrX1kq1eaA9le3CK21Vbset6BLHlDJ JN9Oc57tP7AWCBrgM/a6q8lAEeeGjRbwZrj6g0RFNPyRqoCnt49gs2C2eDSk6zTDr3tE41qr9wyS4 ddA0GxAKv9EeT2LxNPWdSXcHadMf3Z4gRHnxqbd1qUSA6s/zMJPdy9DXp7raACmraj57Nu9NQuuIE IvLjRRrw==; Received: from authenticated user by zero.zsh.org with local id 1lw9XH-000JHf-N7; Wed, 23 Jun 2021 20:31:47 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f181.google.com) smtp.remote-ip=209.85.208.181; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f181.google.com ([209.85.208.181]:33695) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lw9X3-000J2e-LP; Wed, 23 Jun 2021 20:31:34 +0000 Received: by mail-lj1-f181.google.com with SMTP id c16so4670578ljh.0 for ; Wed, 23 Jun 2021 13:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=31YiScwljtd4WtGuM2RoJagi2JxOrt7uXAJ/4UdVeiI=; b=WkhUo1eDX+ELgR5zrM/hikIODluoN4Kd80xZU3zClWBHlAOd/+8bVoFsse8sdDkLeS 3G6e6g2DKfwbI3r7ubuT0vacyzbX30qVEkkj2fuLLwpV4sejSAT07X2YxfOdNU9sxgxE BB/Ahky6MvqSd7bS4ltAGWZ/Ym77aIUjax1L2hjgk4mXPvUzFoXOqQmrdZpdLEpWRDzE ZR5a6Ro+Ndctk+hQ7zfcAjyYdwb4cvgiUkLxQUyQ82EodPuDmb5DxfqJd0BttbwTbpoV go+mX4DUBWuwfDsIJNqk2q6ExynFy1nM0ETTfV9ZMiTVzgV88qMY2HXOZ0TLYl8S3ClQ ku7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=31YiScwljtd4WtGuM2RoJagi2JxOrt7uXAJ/4UdVeiI=; b=m3EePBOMwLKo5psCsLGyYULVyWjrfYRtHlFaCsUQZOqllHeplgNiJBKW0MOlgQf+ib qX7oKPFGoSHBppB/PsnOL3ze9dDh31SliS/1zB24WE/qYWjeAPzGT7TdRNqMaeXYaMLZ UM7FEWMfZrl0KYV4WdvxuY8KmZ7XjHY27/IxOPAcXzh4BXAuLN7WPHFBEAWcH4vFQxQz VZE4sXGJFMVwF+hkV+sa5bmynvnIf+HWcSqC4BmL2nBuVF9iAtYsoLvfZI4NwDDDgdLn gz49/uSrAdl9VclKVd+hvI6zARCoq3vCETDOGaUCmntYZMTMzv26+3RWldQMS39+TUUh gA0g== X-Gm-Message-State: AOAM530qzgTRpPkjGg7YWRUAMV+5DNZUqmQxly7pgKioLQnYlavhTLb/ 2OqOnsQef1JCCpbejZGhRcsTGaHbQTLcf2G7fSiBlDkJadY= X-Google-Smtp-Source: ABdhPJxsl2uL9uqXM0xxhbS8Y7N5QzZMZYAsVbescnjVqtSlN10tyjMP/6CNMZZlOlz/hxMQvvpz/TF+VszqEKo6WZk= X-Received: by 2002:a2e:bf21:: with SMTP id c33mr1151536ljr.28.1624480292263; Wed, 23 Jun 2021 13:31:32 -0700 (PDT) MIME-Version: 1.0 From: Marlon Richert Date: Wed, 23 Jun 2021 23:30:55 +0300 Message-ID: Subject: Does add-zle-hook-widget violate the contract of ZLE hook widgets? To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49104 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: % foo() { [[ -n $foo ]] && print foo } % zle -N zle-line-init foo % autoload -Uz add-zle-hook-widget % bar() { print bar } % add-zle-hook-widget line-init bar % foo implements a perfectly fine zle-line-init widget. It obeys the contract laid out at https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Special-Widgets, which says nothing about return values. There are plenty of such zle-xxx widgets out there in the wild, written before the introduction of add-zle-hook-widget. bar is also a perfectly fine hook function, implementing the contract laid out by add-zle-hook-widget. However, through no fault of its own, bar will never get called, because once foo has return non-zero, azsh:zle-line-init will not call any further hook widgets: function azhw:${^hooktypes} { local -a hook_widgets local hook # Values of these styles look like number:name # and we run them in number order zstyle -a $WIDGET widgets hook_widgets for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do if [[ "$hook" = user:* ]]; then # Preserve $WIDGET within the renamed widget zle "$hook" -f "nolast" -N -- "$@" else zle "$hook" -f "nolast" -Nw -- "$@" fi || return # <-- This is the offending line. done return 0 } (Comment mine.) Isn't add-zle-hook-widget here violating the contract between foo and zle -N zle-line-init? Should that `|| return` be removed?