From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 006b078b for ; Wed, 20 Nov 2019 21:42:51 +0000 (UTC) Received: (qmail 24953 invoked by alias); 20 Nov 2019 21:42:46 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24453 Received: (qmail 9745 invoked by uid 1010); 20 Nov 2019 21:42:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-il1-f180.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25635. spamassassin: 3.4.2. Clear:RC:0(209.85.166.180):SA:0(-2.0/5.0):. Processed in 1.155211 secs); 20 Nov 2019 21:42:45 -0000 X-Envelope-From: roman.perepelitsa@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.180 as permitted sender) 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:content-transfer-encoding; bh=acwNFnU1QStR/ay7HPp+eukIFaWRr9YfE2W3uAQQJco=; b=teo88FqcGLmvnOZ2qDEtVc0PmT4+hJEkBieivq9TJZoqNGR4ZMkfUe4/SVjpGuauKx Qwm2jcIWle36rr9EYSRbmxgrErvt8G8OSWPjAgTScv27SX7nYf+MzZ8fMu1vD0ICOsza REahnyGkV17r1XuEWvhdnvaG+okJAs3P8vrAZgseHLmh1tQLLCkDxsGw5dhM8T3SJpty 5mWeMQ8mbqjdVWH8p+8NsfmcgHXsF/1CDyGkO/f0GArV81BF9F9i8LmDiL4f84ym+LXB J+0hrUhF+3TSSP7TxQmIRrTk3L8WZF/WnP88SLvekYi1BVNdmZLmiyxbX1tzBwimhACG 8heA== 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:content-transfer-encoding; bh=acwNFnU1QStR/ay7HPp+eukIFaWRr9YfE2W3uAQQJco=; b=X1ormRk/H6L+UOO08bfpVuy8qa1oeYOP0OAIejku7C+5WCS7TPBNgCXi0YKYO7S9rx DWbqpu6ldRcD/6+b0/kYvYLJU7c2Lc4k6Xq+TZM6gOzObH3ubdUfuSXMZg2wPGBHieOZ /0MRKa8EchxQ36qphXvRrNtEsS7zMdr/AO/0ri8C9A/ziwyGZj/7VLemN+kjR1NKhqXc yzUIaQ2Z0l4xuNdaE87DuotDep5uII+t2xWDBXNPbD1Zd7ySlNkF1td/DTdLL0IXebT/ WC3vNlDfhyG0uHKfc9CgR0d73mFJDtC+7ae0tFFw+Py0s6G3M6CsL5Sh6x8mIiwKXK6y MikQ== X-Gm-Message-State: APjAAAUx+yGl3IfKVy5rpFD3AChSt257DE1BeDNEE5/HjcraSQEFQ5eX FfxC18D0Aj3DEMnaY1QrbJxtf4IykDrO9YAgL2Y= X-Google-Smtp-Source: APXvYqxqB4J7QEEfaE2z8jCwbZrQ26yWPOAGDBaiA/eWQAHWi9orKvBoXrmEnwbrGiUnr0/YifcQNHZ4atL35vPdBvE= X-Received: by 2002:a92:1705:: with SMTP id u5mr6059202ill.151.1574286130970; Wed, 20 Nov 2019 13:42:10 -0800 (PST) MIME-Version: 1.0 References: <2879A761-D4D3-44C5-8D54-D58D9E3F5EBF@apple.com> In-Reply-To: <2879A761-D4D3-44C5-8D54-D58D9E3F5EBF@apple.com> From: Roman Perepelitsa Date: Wed, 20 Nov 2019 22:42:00 +0100 Message-ID: Subject: Re: Processing "%?" in PROMPT? To: Christopher Nebel Cc: zsh-users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 20, 2019 at 10:28 PM Christopher Nebel wrot= e: > My first attempt was to set PROMPT to =E2=80=98$(pretty-status %?)=E2=80= =99 $? will work the way you want if it's the first command substitution in PROMPT. The same goes for RPROMPT. > I could use a precmd function to save $? in a global, but only if > I could guarantee that it was called before anything else, and that=E2=80= =99s > not a promise I=E2=80=99m comfortable making. $? (a.k.a. $status) and $pipestatus are guaranteed to work as you expect when precmd hooks are called. It's quite common to stash them into global variables there. Roman.