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, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3976 invoked from network); 14 Apr 2021 13:17:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Apr 2021 13:17:18 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618406238; b=bYEXNZUKmGLmT1KINh9EFfme59MMWgQRoLLqY8F57KH9bwDJv8OA0qdyv7u1j7GEErL/dkJWkF 7b+RuOI3Rgif6Bi+aXoPK7DtnF8tX1bF5HLLdUUoBq+MaAFmrb3MfDmj/B5bMDwhhyZRFuqK7L 1hCnUWmOh+YQyx8vv6on5W3uT8VrRoFVShzovaHfgpMWnkkVCo+HY5DrkSa8QVMwh/YMrpJvSU 07dyEd9hKgMLnJWsZz1FkVfwqEsMl9yDJd2v+DRYbC63cfUOYEj3HlmX701Is3UHcmnvHIX74z CfprPLedUt5PJU6qkBJUWiahPyBtn9QHiDZ1023r44yu6A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f179.google.com) smtp.remote-ip=209.85.208.179; dkim=pass header.d=gmail.com header.s=20161025 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-20200801; t=1618406238; bh=9Z1lAXBX9rsjZQtRGmr9VJUa0y7qTTZxtyv1dGo5Fl8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:References:Message-ID:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:MIME-Version:Content-Type:DKIM-Signature: DKIM-Signature; b=sojdHKsJmgXZ5iYHlSU7517irgxDq74Gj4HRMPwhBhdD0xK9QZJQzwOEqEr/Avjmgl9SZ3BlCT Z7yklWmTIc/jOhbZqm4oidyzlya3RUnALJ7aF2L+sGseoOye9C257jmA22PwAhs4jACh/oqjnk iXJlqfEWHaazl03Vk0F8qgTkqVO6AIuRmfqxa38IbdN9/6IY+pDPbZ87ZdUriX6H/VUilPtDRG OEfOz/SHYrZYXHyZK4zRW5PASWAv2BS4smIIzT724+IYpWPwgtsOJx64qq1mDHBe7B/iao5yZR EvJJzZTqp2toAF/Wdevni/g8K6l4cEHkoT7waKZHqbICZQ==; 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:To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=+lkKNALBfvvrJaTcswVLbl1pZ6gKWZeT4ZlZ4QUgoA0=; b=oUohkaHdEClETx1YjKFpZHXo9h 4voywDiuFW0UwsPL5O4DrE1Ri6G1kXjUIAtV5radOM0P0p0UH4+YD9pzy4RDJtGezCu97wMgFYQsz ZxTWJiaqAgRqlSH43rk9MRZJHDfqWlPUdsiYH52UTEP3nqydCD/HukgB5fa12fxYbH0llGNWk5DiT huPqFyFnjisleEt7lti8GjknbPgtWhkzk4iz7uvPjggNeCb/NKVeWMAv/lgh2tkZTh21E9WZG6oPX Hz72S4h7jAQEuj43GBK+fgywAxStqSW7XIM6aACjfr23wOWfrDuI5XJmQAEWi2LFk3wcJHHpLkSbx hsak6byQ==; Received: from authenticated user by zero.zsh.org with local id 1lWfOP-0003R1-M9; Wed, 14 Apr 2021 13:17:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f179.google.com) smtp.remote-ip=209.85.208.179; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f179.google.com ([209.85.208.179]:43739) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lWfOC-0003Bb-Mm; Wed, 14 Apr 2021 13:17:05 +0000 Received: by mail-lj1-f179.google.com with SMTP id m7so12418228ljp.10 for ; Wed, 14 Apr 2021 06:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+lkKNALBfvvrJaTcswVLbl1pZ6gKWZeT4ZlZ4QUgoA0=; b=tOr24Eb6BjZwXOHPsZ73SQe0Za8egu2o6HCd7GzymIyB2/9ZIJtukG17SOgU41KEau dmSs7CV5S4XZtIsxosNS1b6S2XklhLCQU1YWHSWkkulB4F0mSFlj7X0SzDFxBupRtHVj 3nrBp9MHAiKPQpdOt6W3TVx7Cs7vN8o7LKVG2qv1YN8jX8XiXnXughpIg5wBoLrDhysG dFsIJTfIXtQN06yC+MXBBshZ0Sj7Ixs2v6z0FIxNMoCC7EmH93b32XH+0pIH3ewTG9e4 0cVyn5P51HXzNO0GbJZrjq5qx6vtlqEw4qdr570Vzv6SAMoOy2d61Vt5ROUKtdlKgqKG LU+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+lkKNALBfvvrJaTcswVLbl1pZ6gKWZeT4ZlZ4QUgoA0=; b=VR0HGcdb0whULj+lnm+BdWkxHagbgQdi9zo1VS1xmxlG5QItOKwFH//VA8FNzrmep6 OD7xPl8/pkyR8NtKTUQaGjaujpmcvZ++xslS5zuoVEqqUzp66as4Ep1JlT6V5AWR237S NZUIH8PrARmdPKzRNBqMT3P2jvjaIj00WQvfW6xJkdI0iFEG+4T23IwbqZEkyLGBZClo SpqfG4jz24T+xfzlVw5qkZAyZkbanXoQtoT9g3Tj00/5fyVR4j3K23mDLVuVjKvv8jcC swQOBJvlR3fXGJenUOMKNARa13okqPxtO3rQo2642tL4OOOXviD6fcqsdCXj4ET6HQXe gzjQ== X-Gm-Message-State: AOAM533fL03kzdBJsbCpWtxjAdpV6Ak7pXRGAR0+/hQ+Z286/NfYaKxD yiOOo6L2klVOwGB7jlqBBPoBC0YJhoLRgg== X-Google-Smtp-Source: ABdhPJx6MFhYijqNwzsQr91gRMcoOSd12CibXv92Tv/jy/ecCweIMdd1tJ6OYXt3NT+CyW68fPH3KQ== X-Received: by 2002:a2e:1641:: with SMTP id 1mr10499484ljw.253.1618406223917; Wed, 14 Apr 2021 06:17:03 -0700 (PDT) Received: from [192.168.1.15] (hag-tkubng22-50df3e-132.dhcp.inet.fi. [80.223.62.132]) by smtp.gmail.com with ESMTPSA id t188sm4442262lff.68.2021.04.14.06.17.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 06:17:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [RFC][PATCH] `newuser` prompt theme From: Marlon In-Reply-To: <20210414120551.GA3882@tarpaulin.shahaf.local2> Date: Wed, 14 Apr 2021 16:17:02 +0300 Cc: Zsh hackers list Content-Transfer-Encoding: quoted-printable Message-Id: <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> References: <7E71FA83-356E-448B-9726-02DF3FF5BD14@gmail.com> <873D08A9-F321-474A-8440-CCE7DCCBA529@gmail.com> <20210414120551.GA3882@tarpaulin.shahaf.local2> To: Daniel Shahaf X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Seq: 48569 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: On 14 Apr 2021, at 15:05, Daniel Shahaf wrote: >=20 >> new file mode 100644 >> +++ b/Functions/Prompts/prompt_newuser_setup >=20 > 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.) >> @@ -0,0 +1,197 @@ >> +readonly -ga sysexits=3D( >> + USAGE > =E2=8B=AE >> + CONFIG >=20 > Two interrelated scripts on zsh.org hardcode these constants too. > I wonder if we should provide these constants in a standard autoloaded > function or preset variable. A preset variable would be great. In C code, you can get the names and = values from `sysexits.h`, which is available in both GNU and BSD. >> + emulate -L zsh >> + >> + psvar[1]=3D >> + case $exitstatus in >> + <128-> ) >> + psvar[1]=3D"SIG$signals[exitstatus-127] " >> + ;| >> + <64-78> ) >> + psvar[1]=3D"EX_$sysexits[exitstatus-63] " >=20 > Nice, I might adopt this. Or, come to think of it, I might teach > PRINT_EXIT_VALUE to do this =E2=98=BA It would be great if, besides printing the name, it could also add a = short description of what the exit code actually means. Something like = =E2=80=9CSIGPIPE (140): write on a pipe with no reader=E2=80=9D. >> + ;| >> + <1-> ) >> + psvar[1]+=3D"($exitstatus)" >> + esac >> + >> + if ! [[ -v vcs_info_msg_0_ ]]; then >> + zstyle ':vcs_info:*' check-for-staged-changes yes >=20 > 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. > 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? > Also, there are literally zero comments in the code. That makes it > rather unmaintainable by anyone other than you =E2=80=94 and I wonder = if I > shouldn't say "other than present-you", since future-you may not fare > any better than present-me at understanding the code without comments. Sure, I will add those. >> +prompt_newuser_setup() { >> + prompt_opts=3D( cr percent sp ) >> + >> + zstyle -e ':vcs_info:*' formats ' >> + reply=3D( "%u%c$( prompt_newuser_format start branch repo )" ) >> + ' >> + zstyle -e ':vcs_info:*' actionformats ' >> + reply=3D( "%u%c$( prompt_newuser_format start action repo )" ) >> + ' >> + zstyle -e ':vcs_info:*' stagedstr ' >> + reply=3D( "$( prompt_newuser_format start staged )" ) >> + ' >> + zstyle -e ':vcs_info:*' unstagedstr ' >> + reply=3D( "$( prompt_newuser_format start unstaged )" ) >> + ' >=20 > Your theme does _nothing_ with the 'unstaged' style other than > pass it through verbatim. =20 After setting it to '%B%F{red}*%b%f=E2=80=99, yes. > That appears to be NIH. =20 Sorry, but what does NIH stand for? (I=E2=80=99m guessing you don=E2=80=99= t mean the National Institutes of Health.) > Why shouldn't the > theme just advise people to set the vcs_info directly? Because it=E2=80=99s a theme? If people wanted to style their vcs_info = directly, then why would they use a theme? Conversely, VCS info is the = number one thing that new users want to add to their prompt. I don=E2=80=99= t think it=E2=80=99s 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 promptinit changes are independent of the new theme. They should = be > a separate patch and could conceivably be applied separately. Sure, I=E2=80=99ll start a separate patch thread for those.