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 2453 invoked from network); 15 Apr 2021 20:27:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Apr 2021 20:27:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618518478; b=RtumfabSOe4np2c7XE15/gOx9jU29K1nF11iKc3eP5ajMXwjyRm3UQ94GnmsDB5h5La7OOh32I ZDx39xj6/MwJUC1n9r57WBLsttB92Vs3FMn0mJup4m/ljx0IGv/Rs5tebq3KwPf0ktEvfLCrxb DiliB7xw16yEwfmBA5CLqRV6QFW0MW/Eyqz0T/TCKqHxi5+s35L3It/5ZnORvS0MEQRUrTjnwl u5KRrBboJNcC+vFfImpXSRl6AZLHP8RDM3VtP97SraOyB/PuQQbjQWjcB+ZKAhNS8cIAQD6Ngk gcxL3UdJ7kREwiE5r3yD211ZTQsRM/GFVR++cwmwRo9COg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; 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=1618518478; bh=6o6CZgK33Cu7o+ajyUNLNv40DDTBlvNaXoC2X0dq5cA=; 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=Pfnf/odNcxZS2j3+sxz1zhOV4RaaH4C/Jdbl7rNcMKK7gLd+33QBhKfmwH8xL6BNkonBXn26Sz 1DIQFvL2hCAS5F7tvoOET70QSU08qGe77V4q8nTcWj4sHEdAlVNLpH2cGDfsSskEpUIexZ6iyM 0LQTBIOun847+IlXzKYPEiiGqVvwYYqaQeXnt9/Y1fj8Bgzy4mFbEV1YbIXcwVZlSgVQoNCqlx QhV/RLR/fWbhqgj0UWmfdQ/3WE+CKrGZj1kGGfIW1aVxrqIi386bEWd3xHIiJGud4U5iAeA8qg GjswrYXFXsI1xjmazK4pBR1aViMYTHQDc4ZIjoxC+V2exA==; 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=wrawMO85SVVMFU6NQ8GgD2BpkkZ+jgoactgyl7oYZag=; b=Qnr02CK64RyUx/f4S+XvraTbSb OT9K0D7g2Cnj6Pmfq6REnamEUEtRTu915khS4wVOr3nrIgXBiSF2i9PEhI4ctdsb+7NNnEjy6Ihjg rwVH3DpgqZ8kCKnZd+ERbn3HG/c+9kl9VhUpu+fkapAoUBbDwPrzcPyKyDYokAOBWPdulqJj9IeYm 2UKydCGdW5q2bUXiQVbNqXxA0PTlUneyhc70Coudg5md4PgNNfKwyNLpWizRL7oaPBfsrBbQL9VyC x1B23FNxC7BRyqcLNL/FCVbSy02d7cpmwUE/KV3dL25nEi/xcFuHkpQvPWskHz7dVK068mTNsnLrM MvlL7tbw==; Received: from authenticated user by zero.zsh.org with local id 1lX8aj-000OAn-P4; Thu, 15 Apr 2021 20:27:57 +0000 Authentication-Results: zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; 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 out1-smtp.messagingengine.com ([66.111.4.25]:54343) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lX8aA-000Nw0-W8; Thu, 15 Apr 2021 20:27:24 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 4CE775C00C9; Thu, 15 Apr 2021 16:27:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 15 Apr 2021 16:27:21 -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=wrawMO85SVVMFU6NQ8GgD2BpkkZ+jgoactgyl7oY Zag=; b=HJDZ98hKQka4npHkmt9Z/AmTJyGmPp7pluneGywk5DQKh8IEjnje/n0q A7zVsgkSF7CEOBcaNLUPY7XEgOoujvF6eKCr0B8JKN4+jDSkOJDf0GtG4J1qZk7k iQ09b0sFgfY3Zq1koXGdWSQGMgtWxzGD2wSdslAfhtu1Uc8FQ8GmebZpeKEtYmCM ZzWcDGt65E+300PYmct3pwCXNRORQ51oDcTcohZphDUDbYd/fXzqfQd+9xe2ZS+Z HLzJFxz2Lu5PiBDepLQidZ61N3NuS32FqsO1KmavJDyelyKOK8zxy9yl2U8YGYVA onFzoNSWLVD2F9Z/Fc7BsHZhAsCq3Q== 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=wrawMO85SVVMFU6NQ8GgD2BpkkZ+jgoactgyl7oYZ ag=; b=pEadU9+2L/+Y9YXtgt0G62qlGALdWuNevEd7qqwlLzkVBjOqD6lQz7JUL r5L4P1Hu5jcNOt7OzBk41ZjcXOVJDTERx02dZ2GPO2qdWrUZCQoRikX3AkjYKbev 5hSKWCccsU8unQcLkA41ErPXRatOEVFCDR72HCPA1i7WkzdaGQBi6pxFIev9lIx8 kscrY+9hs6iAaZzdI33XTWVyOQaN6oqdQMPkrm1XDNb9G2LdsVAdXtl7/x7FqKAi 29GyczNNLmu3TOz7WmeJdGuh0aplBSB5tDyuom8aEZLGM01vmd+TYYuEC1H5fw5+ +VsaKe8Pj7/e/JlwEGxpsYDMBwerw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudelfedgudehgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjfgesthektddttderjeenucfhrhhomhepffgr nhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecuggftrfgrthhtvghrnhephfekgeffveefgeekudeffeeuiedtheehudfhkeeljefg ffehuedvffekfeeutedvnecuffhomhgrihhnpehgihhtrdhhohifnecukfhppedutdelrd eiiedrieefrddvfedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv 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 CEA81240057; Thu, 15 Apr 2021 16:27:20 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FLrVY5SjXz3dR; Thu, 15 Apr 2021 20:27:17 +0000 (UTC) Date: Thu, 15 Apr 2021 20:27:17 +0000 From: Daniel Shahaf To: Marlon Richert Cc: Zsh hackers list Subject: Re: [RFC][PATCH] `newuser` prompt theme Message-ID: <20210415202717.GA6669@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> <20210414140909.GG3882@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48593 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: [ The parent message made both technical points and meta/personnel/communication points. In this message I respond only to the former. ] Marlon Richert wrote on Thu, Apr 15, 2021 at 06:50:47 +0300: > On Wed, Apr 14, 2021 at 5:09 PM Daniel Shahaf wrote: > > > 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). > > How about `simple` or `minimal` or something like that? > These wouldn't be my first choices, given prompt_off_setup's contents. > * You said my prompt theme should not set styles, but what methods > should I then use to style the VCS part of the prompt? workers/48577 and workers/48586 give one idea. > > 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. > > So, what do you think I should I do instead? Instead of what? > How do you think I can improve my code to be less "surprising"? First, the semantics are surprising in themselves. There's no obvious reason why the theme would re-set check-for-staged-changes after every chdir (and overwrite any user-set value of the style under that context pattern). Second, vcs_info_msg_0_ normally neither gets unset nor is used as a flag. > > Document your code. > > For which sections in particular would you like me to explain my > motives? None. It's not the purpose of comments to explain the author's motives. ${histchars[3]} does not introduce whodunits ;-) > I try to write my code to be self-documenting. However, as with all > writing, one easily becomes blond to one's own typos. It would help a > lot if you could tell me exactly what parts of the code you think need > comments. For starters, note that ${(v)_prompt_newuser_formats[(R)start:*]} don't all undergo the same sequence of expansions, but there's zero hints to that. (And while there, compare 48574/0005.) > > Make defaults overridable. > > Did you read prompt_newuser_help() / the output of `prompt -h > newuser`? It explains the mechanisms I've prodiv to override the > defaults. > Some of them, but see check-for-changes for a counter-example (which is specifically documented as expensive, and has been mentioned in workers/48402 and in discussions about your proposed default zshrc in workers/48544). Speaking of which, the help output is wrong because it instructs to set styles for context patterns that aren't specific to that prompt theme. > > (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). > > This theme is intended for persons who don't want to manually > configure their VCS info separately from their prompt. The point remains that the «:vcs_info:*» context patterns zstyle space is global settings. As it stands, the prompt theme will affect all uses of vcs_info whilst the prompt theme is in effect, and even affect uses of vcs_info after another prompt theme is loaded. > My theme is also setting [R]PS(1|2|4). Do you see that, too, as > overriding the user's settings? No. Per prompt_default_setup, for a prompt theme to set PS1 is as for «echo hello world» to print «hello world ». > If the user wants to configure those manually, then they can choose > not to use this theme. For PS1, sure, but PS1 isn't to a prompt theme as the «:vcs_info:*» zstyle space is to a prompt theme. > > > > 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 > > What exactly makes you think I have Not Invented Here syndrome? I am > reusing vcs_info instead of rolling my own Git inspection code, am I > not? Here's the context again: > > > > Your theme does _nothing_ with the 'unstaged' style other than > > > > pass it through verbatim. That appears to be NIH. > > > > 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. > > "Zero" benefit? vcs_info's documentation is not easy to read. Then send a bug report. > I am creating a simpler abstraction layer on top of a rather tricky > API. The *one* thing which your styles provide is the equivalent of «zstyle … formats $a$b; zstyle … actionformats $a$c»; there's no other case where «prompt_newuser_format» is called with ≥3 arguments. For unstagedstr, you provide just a rename; and for cont:left and cont:indent, which are two knobs that are concatenated to each other and aren't used in any other way, you just _add_ complexity. No comment on whether or not vcs_info's API is "tricky". > If I thought there was "zero" benefit in what I was doing, then I > wouldn't have programmed it that way, would? Presumably you _thought_ there was benefit in that approach — but your reviewers don't happen to agree. Don't take that personally.