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 1109 invoked from network); 23 Jun 2021 17:27:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Jun 2021 17:27:30 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1624469250; b=ufXpkvSKoJ/s/XIEbC/2lQcUiRCus4gDQN+PCANbOrv3/egKvkpGoIHCCCh/mYuUmstSFVBKQs 6jGmUzn9nehrb6lOzSBqnvpLLhN57fZB2U8fjfCdraUsVJLI8sFCdiDe1iWj2/Le9zXxOXgWq8 lBgwD9qF5B4K2cidB8Im8DxcR6N5ViHy3MPjjC9do28BeCRYY/n0otsmeUJjr0Fmt/VtTZXsab ht1k3icQ23FkJXZbcLcUsWOmGTEam89Wr7ak/wuNt3xT7nDnuYgCkqY5ZozIZUxRt0ryuS2jng TTiC4AxeBjwuzKsNYwu+jT27DUuwrYI8s0T1Ph+ktjHwLw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f41.google.com) smtp.remote-ip=209.85.166.41; 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=1624469250; bh=qy5+iVqCRJukXOVFDzmHP3PfrX2bwiPHK4wAdZ/Jmbg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=mKxIXoc+pje7Ovbup8Q65Rp8yteH+WWOJLfR8wPz4TGjCjk2q0KUXD6oaimr7OVl5ddmjNQN/L a7CuXUy1efRSJgNn/xPEv/kXrVlwbXSykkzgMU4wrbd0GpMWmVRsMbPEBAKILtNFCCmJJbpQkp VAfx/Nl5aMMGmHQ4dgKieG5Z6Wf4LMPZOhYS6pXwJshqF8I8JsEkXjOoq/tAQxRovgCfHfCH4l T5RhrImg8iZOfPZq2kr/+ZGa5rO4tmP9VSUYGm1PY7U3EgjSE8Rs3NagrGmDtw8JGJiGlAmjuf sx5LcPm71FrtU0dJGGy5m72/INdfeKI7uYLemwDiJ83YXQ==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=vXTklQldESyISpbUuf+ZiusCuF42y/ZBVaxwwv6iHb8=; b=ICUDyy0otnADcaeFzdsnb425Kg rSKZ3pfkvcF5gOrFg45APT4EanJeEPGS/7PnKj8f0GwtSo3yxUHD7SQfeMJJgnCYQs0tlYnVYzXQM 2SsbaB6msC+rznYRXmxvkLOCObDD8rgjVTV0L9P02KJXiwky+mTCPgrCbyA4AbctpK8WqAOb3nVjI I0Wfv5ZkIP+tJIdplyZg54rSYng1D6gz7oc1HwYRCSK7ATTFoZHy6D1h+j2yIGaag3pfTKV+3MRdC tQf/z419H266RKRrvEGSiu90mU0EM7ujcyTF4pELdTUJRpa/3eNlZpvvGhbI4CLJ/mwI6h2Kezrvz mAifHdqA==; Received: from authenticated user by zero.zsh.org with local id 1lw6er-000BZV-18; Wed, 23 Jun 2021 17:27:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f41.google.com) smtp.remote-ip=209.85.166.41; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f41.google.com ([209.85.166.41]:45969) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lw6e8-000BHE-D7; Wed, 23 Jun 2021 17:26:40 +0000 Received: by mail-io1-f41.google.com with SMTP id b7so4407329ioq.12 for ; Wed, 23 Jun 2021 10:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vXTklQldESyISpbUuf+ZiusCuF42y/ZBVaxwwv6iHb8=; b=nvSAdZku/BRWzBX1dvjhDyLAap7Ic08JY7YccKurOnYeglniXJLzRA6jAAQNr7Yv5J pgBsDTCxsj/SW9Fa/P1KVJp+OXMKSS0yydPM8XFHWgP8oYSQYUFAwDGOTw/kv+Wp9OPk /ibt4TYsNHChnpTe7KbBatLl4nDslNtxcpsy8+sF+YK+6yNG1F3lkdq9krYD0j/T9s1h ecA/u50ZKHdj8IGo1GtQkApiK9igjLpoTnvyIOhKn8nxpUxRqq5CSGOfhLLogMDzAt4R d6ev3QQbHTwnt6hJQxJlkCgIO7G0JMmqaJUuTE25CmUSSUhcrVXGNGemu44qFFNc08df 8K9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vXTklQldESyISpbUuf+ZiusCuF42y/ZBVaxwwv6iHb8=; b=icbNykgfdqq/7PCJWCWLL6yJ4jChnCE9v9PMeL41yczdHR+obe8oza03lXFypIvWiN AWkSxZZR3D38YwzGFgl+UkT89aFNmsWfdPPJQVYqSPMvvTxeXYlMfofcZCzAMA/rfpyo 46DdM0LbSRTKhQ8PeZKQp5f5R1jBTMybaG2pK5vIMDQQGEaUGN9a+mDTbUR4/xHEwFDw oMx3fdFkunmn6jBda2vwA4oSa6Ninv9MzYdXJeLBBg+PsfC0lLZPhUTl9b3RITvSg/0D t4Yz2mAlsC3ouPOJ+smFg2trD7dPmcP+F03lj1SMrXlU9X4vFcAUG1bvfC9ZGxA4kxmz EZdg== X-Gm-Message-State: AOAM531EmnkJhm01mk7FSqq0dyLXjYHfNlpdwRw3DgcS8J/GXwwZPm1n xn/PBm+8rRfZzFI4owJGVFbRmImAehNodeZYfTk= X-Google-Smtp-Source: ABdhPJyzNzPqhvvYuNz5pRgZCkbjOUSvK6zP7Khk29P4tgPVq+OIDHq9BDfFL/DYIMuqMf//kEmvNzYiEka0vRQmlBc= X-Received: by 2002:a02:9f8a:: with SMTP id a10mr660868jam.136.1624469198207; Wed, 23 Jun 2021 10:26:38 -0700 (PDT) MIME-Version: 1.0 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> <29E16F69-B09E-44BF-9009-1CF53053D4FC@gmail.com> <20210416171321.GC4535@tarpaulin.shahaf.local2> <93FFDA3D-3C4A-414E-9220-1032ECE5B04C@gmail.com> <20210416193037.GD15670@tarpaulin.shahaf.local2> <9dc589f1-65b6-48b7-a7cb-81f9e2e16795@www.fastmail.com> <48174137-a8a7-4171-bcda-0899ebc19433@www.fastmail.com> <8082812e-b595-403b-9c8c-8956b6af08cd@www.fastmail.com> In-Reply-To: From: Roman Perepelitsa Date: Wed, 23 Jun 2021 19:26:26 +0200 Message-ID: Subject: Re: [PATCH] Add customizable `vcs` prompt theme (was Re: [RFC][PATCH] `newuser` prompt theme) To: Marlon Richert Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49103 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 Mon, Jun 21, 2021 at 12:14 AM Marlon Richert wrote: > > On Thu, Jun 10, 2021 at 8:45 PM Roman Perepelitsa > wrote: > > > > I was expecting the readonly parameter at the top to print an error. > > > > % readonly -gHA _prompt_vcs_ps1_default=() > > % readonly -gHA _prompt_vcs_ps1_default=() > > zsh: read-only variable: _prompt_vcs_ps1_default > > That doesn't actually happen, because prompt_vcs_setup gets redefined > inside the first call to prompt_vcs_setup. $_prompt_vcs_ps1_default > gets set only the first time you call prompt_vcs_setup. I see. Makes sense. > > It's also unclear to me whether this prompt supports clean > > deinitialization and repeated initialization. Doesn't look like it. > > Does it? > > You're supposed to use this prompt theme with prompinit's `prompt` > function. Yes, I realize that. > If you do so, then deinitialization and repeated > initialization is pretty much clean, as far as I can tell. > Is there anything in particular that I should be checking? It's not obvious to me that deinitialization will happen. Imagine what would happen if another theme is enabled while there is a process running in the background from your theme. Won't your theme change prompt when the background process finishes? By the way, would running `prompt -p` unintentionally enabled your theme? > > I see that the code is sending SIGKILL now and not waiting for the > > process to terminate. Both of these make me nervous. The code also > > *looks like* it would work without monitor but it wouldn't (it would > > result in unbounded background processes and zombies). What do you > > think about not killing anything and ensuring that at most one > > background process runs at once? This is what I do in my zsh theme and > > it works well. > > That sounds great, but I have no idea how to do that. :) Can you give > me some pointers? Start a new process in precmd if none are running. If one is already running, don't start a new process but remember that its results are "dirty". When a background process completes, display its results if they aren't marked dirty. If they are marked dirty, don't display the results but start a new process instead. Roman.