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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28656 invoked from network); 18 Aug 2023 01:08:26 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Aug 2023 01:08:26 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1692320906; b=hhpUoMGjACj+zFh6RjiCvughWB7TdF02Yl8JzFvJF1hbG39Nk0WzIOWkKYt/3FCBBnWGsIRfek zqT+MbyAHF96i/CZpRC6i2AmCkboa6A5mhqFWV0mbcVV4y+p3XA8GTCD7jSpbqiq0nr9jnK7x/ OMAIM0bfVFzuiHPfmlVwN8ctmOvubS4jZuhDs5fcMGFd168i+7hDvoAnrtfoKB6skCIVlHwx/y j8m4TKRYPC45WJ4N5ZtPx/Gac92pVBj1JSV5WkXvEo4UkkJY5wLgfONwSEXjKQLGnz64iCHkpq sYhRzq9lIxmeLcAPznX5/kiTxrHGK1MdRcWkusIsrDmglg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 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=1692320906; bh=PVInB8VVOQ1lTMxWlN2BBinPludJI3feTdAmAiHD8rE=; 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:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=kD4+xl2/G9SEbQHLLjORsdi+reG1tVV7AtWnTutGmQvpSdSivJ1ZuWTNjvswJd/F+YKeQ3jlUd hdXv1xt4luiwOivlmOtYp+0qPOuYVxzT6o0sGpzBmRVxg1BmX6a8cT6rZ5ZS6ou/hQ+uuJTvps 7MdyQ5nuxV+1V2OeIB0oe5aLeqfKdhApxDUqvZqjXk9dn2YEWYXAj3LMWJ4fBxA1IvU+BCID6p PmgaBUU+V1JkAlbbucQ02bl8DT5LL6FH0tzxONwTL42rWWDJuYA9Jt+zDFo/MtZMykIYd48MZL 89k3mWIQqnh+qVXkodjhmlI9mFDVRQjboqN9EYNGxvYtrw==; 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:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Ltai8Yaf9wNAU/gBiZg/mgtxq4asFSddwShwxNxc19E=; b=mWJZ8Ox2giM72WnY9U4mekcX7e h2UU/fVMlAGNAa0pa4rC6zz1regFo8GajamaNGn/jBmQrwcFClkpu9iRsRLkygYNMzTQ5YE0qMkDF sMrslBfJHap02K4jKznlTPhEU2gRHuzz/hCQCaCiYTHF+jzhHn0JSuDzA7U0evZmqh789TO2Fe58K tgggrO5rSjWXYOaG0p981lWSitIPuht8ppeQP2Aoi+NYjE1km5c2mRad1hRBTTlqK/5YQ/35NaRbD 3YxpmMFLSqe+EJecI+8/wLW02rxsm44clItCwICc0ZxkmGO6C4VmBJPiUytHYdHc/O68n2/w5XTRl J9MS5Qgg==; Received: by zero.zsh.org with local id 1qWnyT-000M7V-NL; Fri, 18 Aug 2023 01:08:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f43.google.com ([209.85.218.43]:61593) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qWnxj-000LPO-E5; Fri, 18 Aug 2023 01:07:40 +0000 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-99c1c66876aso42419466b.2 for ; Thu, 17 Aug 2023 18:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1692320859; x=1692925659; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ltai8Yaf9wNAU/gBiZg/mgtxq4asFSddwShwxNxc19E=; b=UlQ4ID8MP7VvXYjnvh0PvuvHr+RI2l9fQigU+zyCdQVTbb5h69609CvCnyuUksI3vz z4Z9R8D4eU6em/dEQsHuXN+7cSPtWmPvqH/JvvQZgULDsmdW8eEVmRaJQvZXPoYujyE9 iJjsJ1AODDCGVFJzUqfnyZqsqjGjBD/BhC8WGxuRZaxGKz9cWJscNkf06cHe+goMnyVA SYf9G8y2cBayA4YlgjWVpHOeUcpoZjpQ2fyCN+f/UC8iGAEx3dnOjat3M2ofw/zEHl2k 82JcSSbWvkmEukzcvUypwjQmKqB63wN37mkkTki5z4P2MpJFQ5g6kM/FfcqZ3edgpt+l domg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692320859; x=1692925659; h=content-transfer-encoding:cc: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=Ltai8Yaf9wNAU/gBiZg/mgtxq4asFSddwShwxNxc19E=; b=dnqOa3lw1ga9VAZFkJvY9csTYG8AH46toRMO1BgK0ykmtmFL3nBAf6yskd689pm45N JIiNg8YvGC8a2gzb8l48DE+Y/Z4xwKghvgi/WW2dayJoGAI+WhKW9ocvFCjCtN+YnPgT mxZ7ik/LB6gswcRYjurKg5zQVcEU1cyUSddnMrKh8lU2iyirKXFygBTiXbtHh3rBwokU oW7AmmKthhJK9QQQuXYSxF2DPTVYpAsjEHRSBQ16+MeNkN7R3BmxnYaLyGDxrjFVyJAB Bzz2FMVwyKhKlMAuhw5/zoeMISti5dJfFk2sN6SwACX/32TVuOEdoVJOjMDWqCkscco8 Xb4w== X-Gm-Message-State: AOJu0Yzj9EMOvARqAFpeCz4jxID1i+ayoYLMhTnG51J6YJqNZG1Utt+f R9o5Wmqm9TzkThqDwjDiZAGnE1dcB0EMrRrf03hPN2vHSeEeb221F0g= X-Google-Smtp-Source: AGHT+IHc9GQ+kNojF0SfL0N376Mbe4CcYk5/bi3bcntYQ8eTr+nrqRx/mIQq4i8fZELqKA7xTxcExJqV8voHWG/zMUI= X-Received: by 2002:a17:907:2722:b0:99c:a23b:b4f5 with SMTP id d2-20020a170907272200b0099ca23bb4f5mr761550ejl.53.1692320858918; Thu, 17 Aug 2023 18:07:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Thu, 17 Aug 2023 18:07:28 -0700 Message-ID: Subject: Re: widget function must have zle codes To: Budi Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29163 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: On Thu, Aug 17, 2023 at 5:11=E2=80=AFPM Budi wrote: > > 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" p= art.