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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28839 invoked from network); 22 Apr 2021 20:26:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Apr 2021 20:26:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619123170; b=oYzcXjVG7hfsSZirck4R9MKwl1NzzqQO60SuC+wqU+ahxTfKvCYzbA88BHwadcVCaHcC3GkBnK b2nd7JZKkcBQ8tdgiKsfG6zdygNnNWhLsc1tLoVa3nvhplr0T2H7+pJTAverUMK1larjyJfw3I VvX6qjKVpeOmGwKVmZf8PDBaDqYT4D/RTgzStChzioYTOVFxjx177Evbb/65tMRxNWR9STSCAt QqSK0ihTXR1Uxo+j32Er86IWGmD6lr1CerxWFzmA53v64X0TkBLmQPfS8d6rFVff59dvM0qGOt 4WcChPje3+Nk4ls9yB2kw7Mo1h+qxkn9YN3+4NgyPID1SA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619123170; bh=CMrLxup4Go0oKlHvlG7Jyip+qoA/gzoxUpf1yZ8tWpM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=x6lvHJPQOJD69o3H1v9Q2/1U+KsEci92KKSqidU1OTmyAzZGLRPhIBhcAY3U/L8RDU4tGvhKlh 7f/nGbPCNBz+HwS1gZD5N4Ex04dctZSyzoULXVZ/FgWAI8Vilfuj5aFAOPZOZ5J7EG8TAYv/jU q20QxiiO4r/0A1KrrehHj7ZgAaQflkKN5LyilCC1sUBvopbcc14yLazbJT1bTg+KmYZMU9rux0 g/hHkhTMg63WQAp6MJDeLi9TR0JSl5xL4eZOzlGHWmZRvoMwQk4q3IZC7U3u+3rRVk8V62qa2Q 7ALRSK8Sk/f36rM4A0hjIbiHhhC4QaICHMRvngLIUF1M0Q==; 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:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=SS9z96t0WzqY/6vzhRXnmW+XWaFarZbnevMYeIGKXkI=; b=ShcxhqiJFqQjAiiVGzC5gllET0 ab2gpNItFxdFi8Moi5zRmAonRzlHan4tg+TsSc2zEiRrFvYs6b0qOSeWdYPk8ZCP8uLeS+hNeSKSG jAeVeDp30rlbotBmBBNhjJ2Pxhb8URuTrGxcZEkhD9oQ+Dc7KaiVt0RnX0OuGsKUxiHs1xRkVJX/5 Mp0wpPhG+G+2l8kJWuamVw5z3JD1HfM4ubMTPCMC1VKnvLi1n9kGrTv8t7REF455MNFr3o9+zBc7x VLG6XuPJ6N5ggw0HMK5K9oOhhaRZbohG6MW0Ev9I9XytY8XZMptM0PMQny0mXebPodr9Sd8YD93tK eLj2jFxg==; Received: from authenticated user by zero.zsh.org with local id 1lZfto-000HpH-9E; Thu, 22 Apr 2021 20:26:08 +0000 Authentication-Results: zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:50939) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lZfsz-000HZd-4F; Thu, 22 Apr 2021 20:25:18 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id B8EC52174; Thu, 22 Apr 2021 16:25:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 22 Apr 2021 16:25:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm3; bh=SS9z96t0WzqY/6vzhRXnmW+XWaFarZbnevMYeIGK XkI=; b=WL9IOscYfMXh963m/bDY4KMtpNFDukW7jOO2v2lrz5avUolYELV8w/+U xVPPIDAl4AWFAKWE/07YgZ9g3jmG41ISAJWXLIxc9P7ueho88aiRc7SBwzGSoHY6 6vUgEkZSVD0r+tEjl/gHQpQGbOefAfJIzwqcRPdgU5G1KHLf+CDE1zwYo+Oqygz1 cf9ymAqHcMnQx4y346fBCT4hcAsoxQ8caT0w2+kqCYFcoYLitPhYHfE/A9cPDkKw igbvd45VuSyTdv93zlmnFC9tNnIAIByzjQ4AsTi3kQMpbSw9H8uyPgwFrtzvwMDf zWzHIgS1gEQ2UGxItpxxm6gIiSBWSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=SS9z96t0WzqY/6vzhRXnmW+XWaFarZbnevMYeIGKX kI=; b=kqgd8mz2wlJy6jc/WsKMc4l4szgTjlIK+5dvCj9ghAgtJ5t71rt90ypEy ehkwgCU8K6H1fCqFkcMwfc3IzsjevcB6kh3uBcVRV2/orR/MAcDoFfWOGSD9iXZ1 nD7x3wemypGUTCAvmEusMzXNlY3DDpJE4HI3v4MicmHNVX7z4axjbkzjfaJK/jiM YX7IdTkg/KjLWOOxJ96GW17iwA35Gi7EfQHR7GV/ohWSm+PcYRgwYaQXHj8V1tmJ TjcOWYzVbRfe5aOFI0+GHCkQ+dUa2thzoOAvRyfa+MbkEOAayaSUh0p/WIa3n4kX QKS/4TBL7QvgvyezaJ4jQ1+wjunHw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddutddgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjfgesthektddttderjeenucfhrhhomhepffgr nhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecuggftrfgrthhtvghrnhepgfekgfefjefgvddvgfdutdelleekvdefteeitdduhfev veevudfhvdevfeefvdeunecukfhppedutdelrdeiiedrieefrddvfedtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-63-230.red.bezeqint.net [109.66.63.230]) by mail.messagingengine.com (Postfix) with ESMTPA id CFE82108005B; Thu, 22 Apr 2021 16:25:13 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4FR86v2nDQz1RL; Thu, 22 Apr 2021 20:25:11 +0000 (UTC) Date: Thu, 22 Apr 2021 20:25:11 +0000 From: Daniel Shahaf To: Marlon Richert Cc: Zsh hackers list Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function) Message-ID: <20210422202511.GA13421@tarpaulin.shahaf.local2> References: <95CDA630-4EE5-4003-8D9C-CCCB9A47F109@gmail.com> <4D587C0C-EB5F-4A58-A0AE-D45E43F432CD@gmail.com> <20210421212717.GE21343@tarpaulin.shahaf.local2> <214AC3E9-FFA5-4F39-A918-562682FE3A3B@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <214AC3E9-FFA5-4F39-A918-562682FE3A3B@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48661 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: Marlon Richert wrote on Thu, Apr 22, 2021 at 13:55:35 +0300: > On 22 Apr 2021, at 00:58, Bart Schaefer wrote: > > On Wed, Apr 21, 2021 at 2:28 PM Daniel Shahaf wrote: > >> Again, please wrap long lines in your prose. This is the third time you > >> are being asked to do so. > > I would love to, but I’m not sure when it happens (everything looks fine on my end) and I haven’t found an explicit setting for it in my email client. Please let me know if this email has long lines or not. That would help me figure out which combination of settings might be causing this. Yes, it does. > > >> As to PUSHD_MINUS and PUSHD_SILENT, it would be better to give an > >> example doesn't change them from their default values. > > Why exactly? The very next sentence (which Bart had snipped, but you should have read anyway) points to another post of mine which gives a reason. Moreover, that sentence was the second time in two days that I pointed you to that specific post. Overall, I think there have been three or four unique pieces of feedback which you were given multiple times *this week alone*. We shouldn't have to repeat ourselves to you. > On 22 Apr 2021, at 00:27, Daniel Shahaf wrote: > >> +ifnzman(noderef(Miscellaneous))). More precisely, it > > > > s/it/it:|it+DASH()-/ ? > > Sorry, I’m new to Yodl. What exactly would that do and why would we need that here? > It was a request to change «it» either to «it:» or to «it+DASH()-». The former would append a colon to the paragraph. The latter would append an em dash. The manual sources denote an em dash as «DASH()-» (which is poor encapsulation and a leaky abstraction, yes). > >> +You can use this, for example, to create key bindings that let you instantly > >> +change directories, even while in the middle of typing another command: > >> + > >> +example(autoload -Uz execute-command > >> +setopt autopushd pushdminus pushdsilent > > > > AUTO_PUSHD is set but not used. > > If I wouldn’t set it, then the names cd-backward and cd-forward wouldn’t make any sense anymore. Sorry, I was thinking of AUTO_CD. The point below applies, though: it would be better to give an example that works under the default options; in this case, to use «pushd» rather than «cd» with an option. > > > As to PUSHD_MINUS and PUSHD_SILENT, it would be better to give an > > example doesn't change them from their default values. That's again > > 45149, which I mentioned just yesterday. > > Let’s suppose the following: > I rewrite the example to use `pushd +1` and `pushd -0`, so it works with default shell options. > A novice user has PUSHD_MINUS in their config (for whatever reason; they might not even know what it does). > They copy-paste the example. > Now the widgets won’t work at all as expected. It’s not even the reverse. > A user who doesn't know what their config does isn't the primary use-case we should design for. Besides, we should never recommend to set an option globally if setting it locally would suffice — at which point we might as well set the _default_ locally, to handle users who (deliberately) set the option to a value other than the default. > Setting PUSHD_MINUS in the example guarantees that it will work out of the box for novice users. (More advanced users, I’m sure, will be able to figure out how to modify it to suit their needs.) > Yes, until they ssh to some other box where they have an empty .zshrc file and don't understand why they get the non-PUSHD_MINUS behaviour. (And for that not to happen, then they'll have to read up on PUSHD_MINUS, which increases the learning curve — which is the point I made in 45149. Did you read that post? I didn't look up those X-Seq values for my own amusement.) > As for PUSHD_SILENT, as I pointed out above, using `pushd -q` instead has unwanted side effects. It does not have an interchangeable alternative. Isn't «pushd foo > /dev/null» an alternative? And it has the obvious advantage of not affecting other uses of pushd. > > >> +zle -N cd-upward ; cd-upward() { execute-command cd .. } > >> +zle -N cd-backward; cd-backward() { execute-command pushd -1 } > >> +zle -N cd-forward ; cd-forward() { execute-command pushd +0 } > > > > s/()/+LPAR()+RPAR()/ so they don't look like yodl macros (and > > potentially throw build-time warnings). (For Vim users, the custom > > ftplugin sets up concealing which does the reverse replacement while > > editing.) > > Again, sorry, I’m new to Yodl. What exactly are you suggesting? That you literally change «()» to «+LPAR()+RPAR()» so yodl doesn't look for 0-ary macros called «upward()», «backward()», etc., and warn on stderr that it can't find them. There's plenty of examples of that. > >> +bindkey '^[^[[A' cd-upward; bindkey '^[^[OA' cd-upward > > > > -1 on using random escape sequences without any explanation of what they > > do and how to find them out. > > > > Can the symbolic names of these escape sequences be used here? At least > > . > > % for k v in "${(@kv)terminfo}" ; [[ $v == (*\[A*|*OA*) ]] && echo $k > > cuu1 > > kcuu1 > > . > > if we don't have anything more human-readable than those. (I think this > > was discussed somewhere in the "default zshrc" thread so I won't > > elaborate here.) > > For cuu1 and cuf1, that would work, but ^[[B and ^[[D do not have > entries in terminfo. They aren't used in the manual either, so why does it matter whether they're in $terminfo or not? > I don’t think we should use $terminfo[cuu1] and $terminfo[cuf1] in > some examples but then hard-code ^[[B and ^[[D elsewhere. Hard-coding > all of ^[[{A..D} would be more clear. Disagree. I would have proposed an alternative, but it's an academic issue. > I’m fine using $terminfo for kcuu1, kcud1, kcuf1 and kcub1. Using > $key[Up] would be even better, but we cannot rely on that being set.