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 10264 invoked from network); 14 Apr 2021 14:09:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Apr 2021 14:09:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618409374; b=F1SReQF6BMFwW7jdwdWuSjFs4yvEO/6t5rujhcABcNBl8o/s+Vy5sw6DIm99vhoX6wB2Fe5DsL pwmSxiAqijwj8PFoXB+yfYaqvZMHBq9vUkXU7MEzEtBu2bJBNNwqstdmSrhUsvdgHAgP9JMM3u TnGkuC9RKcSRP/h9OOOtN8a3B+aVvmxRJOCeZU1sqTIjAGCuHur5UCBqpnifnHooBDBT1tyvwK Ke+lKaedt7hQokqWSo4NbnJ+t8q5Huee6odoygMtx8IvjhP46AfvfTG6AviuCaYuyqQR6jd4FX ZtIPORYZB6ss1/8QN9n9LIW+TUndV+aFtF3eQKoWkvtV8Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout5-smtp.messagingengine.com) smtp.remote-ip=64.147.123.21; 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=1618409374; bh=ogMD/6duMYrvAExgxn4GB6x989j+x/D6ea+DqhZu/D8=; 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=k4srS7TMh9J3FvstXpcYxYPJpMTJM2AtTcYtTI2EQcGtew4K0BuShzzy2+OIuo/sOgPJLNQOWR PPiTFmbwjHFhkS6v3VZkZy7MiUZVDs3AQ+kNH+4Zw2gzp/ZPUWLlc0g75Df7rNfW5UACCZ7+xz zdoS0h4mZBhCE+cRUDOI8HCCiMbgw7rskKo8d93XNkGc5P9maanYzkTIrwp/tFNnk6KtX97Rcn bCT2eLRhspCLjniXE3Q7gyCP6l0TvWOWcpThu59fdSnfUXKYU9l+JE3c6iAq5c3vrlVu6k7iuT xGxbvcZHzC9WTgz0/xocOoAoNwEy0AE8IRkeepN2DS+c1w==; 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=M0S94foi0Fc9Nw8iFZzKk1gMFYsFUlRVyz4T/igeD1I=; b=0vJTE/oU587ZUZkVayCziC4++L M3tbdJ/856sCsJWjpzk4531UNFEtNwNagJxf+AV3pQfll6UQjieO9dDsjLwTd+Ea+7pVnTNQT4sVa Z7svS/XynKK2Z8APbRvZagqIBh5B6Y6v4P1uRVbpjQ7/ggjHbG8szAqJbjmrPSgrOpwjMbBmbTojS 1S0aL+kirhiEv6fDPMvF0CPBtxHhKf9U4eLKxsH76f17sPs6n0ZdCggeHnEC9+U0GpdK0zJgnf6Bt ivot9lnklMPa3U2MCXhoKsfjMeVH7ol/G9vO03f3TM1+iXtkKRMkSd/2T5Jl91mxIawS8YNMuGqit hHsu4RKw==; Received: from authenticated user by zero.zsh.org with local id 1lWgCz-0005ZC-Bt; Wed, 14 Apr 2021 14:09:33 +0000 Authentication-Results: zsh.org; iprev=pass (wout5-smtp.messagingengine.com) smtp.remote-ip=64.147.123.21; 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 wout5-smtp.messagingengine.com ([64.147.123.21]:59267) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lWgCh-0005Jn-Na; Wed, 14 Apr 2021 14:09:17 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B2E9718FB; Wed, 14 Apr 2021 10:09:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 14 Apr 2021 10:09:13 -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=M0S94foi0Fc9Nw8iFZzKk1gMFYsFUlRVyz4T/ige D1I=; b=AkCczzUMPynYpfMyz+4qILuPEWyYydFwT61SlJ0la34W/mWK6hBN6X/c sIuNguliMwp0176JUAY2zLU8zFL3yiTznf1XxNifc5X1Ug5E6eQm/sG8HBYVeGQt J18jTzREQZhVJ0qM3nldMGhuKfhFg92aMsm+IOlVgT3GtvGnIRyfkb1e0NGaDe6c BVjh6nK9sg2HLBROsHcwhOgCzahj1E8spd8kR0vTl0DQgo8kMOoJ323kdy3K5KtR Vquo1hdHCVhdCAfwRqegJcTAq3t2qIVbNM/05WwlByhWvt5tnP2Obln5c4r+wel5 tQTff3mcxRp/LgV5/eYuCro2r/X4Gg== 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=M0S94foi0Fc9Nw8iFZzKk1gMFYsFUlRVyz4T/igeD 1I=; b=cARWbbDmBCZ7BsJ5pDu1X2dXgKDoy5bxlzjyUO6CjGVpI9wys2+UiJh2e peMbxwhlft6kKV953e0Zr23fzjV189PVqPgkdA2FDgm2VkQjnGjWwosxnyCwHAy7 Os7h6/48zQourYNw6ntKmYrK0KS9ff/lYQPKJXp3IyBJjO4UuTjQDfYlZwAlJ7N9 ripcyvcVKu4ftSFq0Xf8JFouxV47TGROEB6V6CxUXOZdLUuMvUMne0d1hO7PRsNs HaVRECV/9/kIAl0ddSI4BYb6eh7CGnJxhr1FKd8OXXfR4YY6BAkjnLx4kq9u8xDc erG/i2arRhLzkYIDgDvrHAH9AnUNA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeluddgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggugfgjfgesth ektddttderjeenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghn ihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhepgfekgfefjefgvd dvgfdutdelleekvdefteeitdduhfevveevudfhvdevfeefvdeunecukfhppedutdelrdei iedrieefrddvfedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv 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 B3FC9240067; Wed, 14 Apr 2021 10:09:12 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4FL48j2Qxxz43s; Wed, 14 Apr 2021 14:09:09 +0000 (UTC) Date: Wed, 14 Apr 2021 14:09:09 +0000 From: Daniel Shahaf To: Marlon Cc: Zsh hackers list Subject: Re: [RFC][PATCH] `newuser` prompt theme Message-ID: <20210414140909.GG3882@tarpaulin.shahaf.local2> References: <7E71FA83-356E-448B-9726-02DF3FF5BD14@gmail.com> <873D08A9-F321-474A-8440-CCE7DCCBA529@gmail.com> <20210414120551.GA3882@tarpaulin.shahaf.local2> <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48571 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 wrote on Wed, Apr 14, 2021 at 16:17:02 +0300: > On 14 Apr 2021, at 15:05, Daniel Shahaf wrote: > > > >> new file mode 100644 > >> +++ b/Functions/Prompts/prompt_newuser_setup > > > > At the risk of bikeshedding, I don't think that's a good name. A name > > should describe what a thing *is*, not what its intended use is; and I'm > > not particularly fond of the implication that new users should be wary > > of trying _other_ themes. Besides, what if someone else were to come > > along and post an alternative theme aimed at new users? > > Sure, but what should I call it, then? Just `marlon`? (Seeing as we already have `adam`, `bart`, etc. themes.) That'd work. A name that describes the theme itself rather than its origin would be even better (if the theme is accepted into zsh.git). > >> + ;| > >> + <1-> ) > >> + psvar[1]+="($exitstatus)" > >> + esac > >> + > >> + if ! [[ -v vcs_info_msg_0_ ]]; then > >> + zstyle ':vcs_info:*' check-for-staged-changes yes > > > > First, no other prompt theme sets styles, so I'm not sure prompt themes > > should be doing that. > > Please show me another way to theme the VCS part of the prompt and I will use that. You seem to have checked your manners in at the door. In any case, what you've implemented is that you re-set a style on the first precmd after every chdir. I don't think these semantics should be implemented in the first place. > > Second, even if a prompt were to set styles, doing so in a precmd and > > behind what _looks_ like a "first run" condition but is actually a "we > > just changed directory" condition isn't exactly best practice. > > What would be a better practice? Don't surprise/mislead code readers. Don't surprise/mislead users. Document your code. Make defaults overridable. Don't trample user settings (e.g., someone explicitly setting that style to a false value for that same context, or for the context «:vcs_info*», which is less specific than the context you use and thus would be shadowed). These are all such ground rules that I'm surprised I have to spell them out. > >> +prompt_newuser_setup() { > >> + prompt_opts=( cr percent sp ) > >> + > >> + zstyle -e ':vcs_info:*' formats ' > >> + reply=( "%u%c$( prompt_newuser_format start branch repo )" ) > >> + ' > >> + zstyle -e ':vcs_info:*' actionformats ' > >> + reply=( "%u%c$( prompt_newuser_format start action repo )" ) > >> + ' > >> + zstyle -e ':vcs_info:*' stagedstr ' > >> + reply=( "$( prompt_newuser_format start staged )" ) > >> + ' > >> + zstyle -e ':vcs_info:*' unstagedstr ' > >> + reply=( "$( prompt_newuser_format start unstaged )" ) > >> + ' > > > > Your theme does _nothing_ with the 'unstaged' style other than > > pass it through verbatim. > > After setting it to '%B%F{red}*%b%f’, yes. > Hmm. That's a good question: how _should_ a theme set an overrideable default for stagedstr? > > > That appears to be NIH. > > Sorry, but what does NIH stand for? (I’m guessing you don’t mean the National Institutes of Health.) > Not Invented Here syndrome; cf. EEE :P > > Why shouldn't the theme just advise people to set the vcs_info > > directly? > > Because it’s a theme? If people wanted to style their vcs_info > directly, then why would they use a theme? The point is, you're making people learn a different syntax for identical functionality for zero benefit. > Conversely, VCS info is the number one thing that new users want to > add to their prompt. I don’t think it’s unreasonable to expect that to > be included out of the box. Nearly all of 3rd-party prompt themes in > the wild include at least Git info. The question remains whether or not for a prompt theme to set vcs_info styles does or doesn't violate the principle of least surprise. > > The promptinit changes are independent of the new theme. They should be > > a separate patch and could conceivably be applied separately. > > Sure, I’ll start a separate patch thread for those. Thanks. > Daniel