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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29906 invoked from network); 18 Aug 2023 01:29:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Aug 2023 01:29:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1692322169; b=EfbAbyRVtU8aw+AlWf0JEH0q7h2q4QyPG4N3M4y5M6Wuk3vR7KkF/lw1X+Li1UrpBwUUA7Ae9h iMujUGGRL+UH/GDexpP39xFt2otpuxcLve44f8pSEnNRro1wA0Ni1JWXTMEWuSVdCkA+Lofu/v dh3KQVxbLe7dp/GYAK1OIYWPmJ0VIDSFkAwixRRtgpxLvYirqop8V2PqJShtyl1jnJ8avnboR9 RwjAcBxNL571Mc3sE/EDFiqnRVUKOKUfjZJsurbmaO2tdKc9M1HKTTd2eRwOpyK7Tk3XlnNahu 3W8fxtQwYqXO7ZD8Rak20N9ryZy515F3uT+uUvFaI5sFXw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=gmail.com header.s=20221208 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-20210803; t=1692322169; bh=sPXBsQUo07kcAhozi3+mJDbHdg1KU7qCUiyGcIlmyNs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:References:In-Reply-To:MIME-Version:DKIM-Signature: DKIM-Signature; b=UFJlZiqUE3OvMD06xrsjWiEZJYIc3h901EyQbIwBmJIWrfGMlmYaA/uXSlOjF9scB0ISIzpXzb 22m7qa2ZCdrjBxB4UaqT+RGjlwPa6i7jLDIFNBf9WUfviMMuV8WnyjiCWdCr5GFbtucY4lHVud 7rV16gx/XwkSmafA3+1sI3xNOMLh6bXCDjCEMAUE2xRK+2QWr35N+xsZo441R0ZWstIaRtCNZL HCn1/i56N9QkRTH9rc2ZbzvKul6U81rVqRU47NYIeEbwQI6jlHygF1RF/mem+q6qMs86igUYnE znJ8hmHc1+EWjZ93KaBMYgX5HZmrK3i4b+tS+O9NxTBmkQ==; 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:Cc:To:Subject:Message-ID:Date:From:References:In-Reply-To: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=u9SLpTeLhC5jcTdq7dLa0cvuV+KjtTVkBA+U7i1Engk=; b=NMJlnNDPVi2/r0RWgjUjfADJyK BFdbySNGiLJbwV2Jepy9yjcwJ6ZGTr9lMuLFBjwFBd2OtDt1z9fIgIe+FdXELNBgnzLF7m7tinoke xWjA8qjBfbvfPuDRrvYJ5bhnszbIVaWZ6mOCMffq4ayOEt2GRr3p8eoIkL6/FUcj4u58QNYa62JeA F/GDfy32SEZL+4P3VV2t6C1OmeA676r9sNJI3md9127ausSFzqYN5li2gKBp1O/XekWcTFayGeY0U DucpOTdSyBFXWx0PeBlFgHFBCBWpNVLNQ5wI5vStcy5qy+XB+MXKQkZGVYG0kcZxEjT7H6Z4kElpk OhYRMgnQ==; Received: by zero.zsh.org with local id 1qWoIr-00005p-Mi; Fri, 18 Aug 2023 01:29:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wm1-f41.google.com ([209.85.128.41]:50442) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qWoID-000PET-CL; Fri, 18 Aug 2023 01:28:49 +0000 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3fe32016bc8so3997595e9.1 for ; Thu, 17 Aug 2023 18:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692322129; x=1692926929; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=u9SLpTeLhC5jcTdq7dLa0cvuV+KjtTVkBA+U7i1Engk=; b=djGfbyx2Jvk3MLv4Fz6TBNSnS+rkXniccuEIzHCeUlpLJDUm8NiTFdS6zDfWJ9NQG6 gIpJonqBVBHGxZCWMmo8SDZKfhSa+KQo1WhMQnM8Ux38t1gdoIIX7iJagxqOfXI1fJlm 7bHPvHgPGs/8UnmE0RMUOMrwcG/KmYh+TU9ju+GXN/JuOx+8xxOrra8L48WCXK19mVP8 85RXZvFksSphNxke0roDnZiEQ/b1J5JihD8g/snwJRVadCRB1M48Ee6aPNL86WIUI38h MVP8ejWzk61OUQ3ywvE+eBCdoVl4aTsgBu0SpnmqZTrDx9rA2E4MXYkUrrckc32FI8q1 0fDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692322129; x=1692926929; h=content-transfer-encoding:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u9SLpTeLhC5jcTdq7dLa0cvuV+KjtTVkBA+U7i1Engk=; b=EQAZCoDVYTyLserL3LtxTCRTpZhSTSx9CsbUvqkryHlr15//8ixbMfqB1GfkJQeS2Y hbqZp6pdm3wxofecgHdCtwlj8sSRSdSTXWQ5JqCMogJcY1lk6Oh0Fnm2cX5KFzqShGGD xo2pL11yIdlCn/PvdKxqEPKXNJ56bIxez0vA38NAVdAqtvMBwN/0fRVPgBaytQ4OJGAu RnkdexK1rdJApq8caBuR3l7NsZZ4gtw3fCHGAZK6umqSBAdFL8nQmm0xZW5a+QWZgpJf zc/MaE+nV3owf/9o1C/0171EbJUGyqJd7w9O+XSEl/mcElZIVwu18NUdDqxe/SD+GyAY xp0g== X-Gm-Message-State: AOJu0Yy4pNFeZrIxpqpMpm0FBeXVTyYcPXfjxrFVti6D2GtYqsw9tHOB 7c4SNUvY68QuSTuFN21HvxBHF/tAb8wdMdX4YpaN2JLf X-Google-Smtp-Source: AGHT+IHafW7Z6UGUFQfJwwKgsjeXCld9jTleGdyysWFKlXX7kdPTjsNcx10fqUQHSbE282bGEyUpCBOjUiZPu6vrsL4= X-Received: by 2002:a05:600c:2059:b0:3f7:3699:c294 with SMTP id p25-20020a05600c205900b003f73699c294mr997544wmg.29.1692322128739; Thu, 17 Aug 2023 18:28:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6020:174:b0:290:25e9:9dde with HTTP; Thu, 17 Aug 2023 18:28:48 -0700 (PDT) In-Reply-To: References: From: Budi Date: Fri, 18 Aug 2023 08:28:48 +0700 Message-ID: Subject: Re: widget function must have zle codes To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29166 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: original simpe aim: to nullify any std output in bind -s, (Bash bind-x default) bindkey -s "^m" "\e[H 2>/dev/null [[ $- =3D~ x ]]&&{ set +x;echo Trace OFF ;} ||{ set -x;echo Trace ON;};print -s '\e[F'\r\e[A" How is the precise correct one ? On 8/18/23, Budi wrote: > original simpe aim, > to nullify any std output in bind -s, (Bash bind-x default) > > > > bindkey -s "^m" "\e[H 2>/dev/null [[ $- =3D~ x ]]&&{ set +x;echo Trace > OFF ;} ||{ set -x;echo Trace ON;};print -s '\e[F'\r\e[A" > > > How is the precise correct one ? > > > On 8/18/23, Bart Schaefer wrote: >> On Thu, Aug 17, 2023 at 5:11=E2=80=AFPM Budi wrot= e: >>> >>> How can;t this work >>> a widget function having zle codes >> >> I'm not entirely sure what you're attempting to accomplish here. >> >>> t:1: bad pattern: e[H >> >> You're getting that specific error because you haven't quoted the >> string properly, but I don't think it would do what you want anyway. >> It looks like you're trying to extrapolate Roman's "bind-x" example to >> a case it wasn't meant to cover. One would not normally create a >> widget by assigning to the functions[] array, Roman did that >> specifically in order to construct a new function body from the values >> in the positional parameters of the "bind-x" function. >> >> Further, it's the "zle -N" command that creates a widget, the function >> is the widget implementation. Neither of them works without the >> other. >> >> In ZLE widgets, you don't normally refer to an action by it's key >> binding, instead you refer to it by its widget name, and use the "zle" >> command to run it. So instead of $'\e[H' (which would be the correct >> quoting you were after), you would write >> zle beginning-of-line >> (or whatever action you wanted). Each built-in widget has a special >> name starting with a "." that you can use to avoid calling some >> user-defined replacement implementation, so you might see examples >> like >> zle .beginning-of-line >> >>> functions[t]=3D"zle -I; \e[H 2>/dev/null echo Test preceding word" >> >> I can't tell what you're expecting to have happen with that "echo". >> If you meant for "Test preceding word" to become part of the line >> being edited, you need to assign that to one of the BUFFER, LBUFFER, >> or RBUFFER variables (please see the doc). >> >> I strongly suggest you look at some of the examples in Functions/Zle/ >> in the distribution. Many are a bit esoteric but most have extensive >> explanatory comments. The easiest to understand might be >> Functions/Zle/history-search-end >> Functions/Zle/down-line-or-beginning-search >> Functions/Zle/up-line-or-beginning-search >> Note these files are function bodies only, they expect to be turned >> into actual widgets by (for example) >> autoload history-search-end >> Zle -N history-search-end >> >> There's also >> Functions/Zle/vi-pipe >> but note that its setup commentary forgot to mention the "zle -N vi-pipe= " >> part. >> >