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.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, 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 1065441d for ; Wed, 12 Feb 2020 07:18:42 +0000 (UTC) Received: (qmail 11750 invoked by alias); 12 Feb 2020 07:18:34 -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: 24687 Received: (qmail 23195 invoked by uid 1010); 12 Feb 2020 07:18:34 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25718. spamassassin: 3.4.2. Clear:RC:0(209.85.166.52):SA:0(-2.0/5.0):. Processed in 2.567523 secs); 12 Feb 2020 07:18:34 -0000 X-Envelope-From: mikachu@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.52 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=WWqmJRQ3vae9BlHGkP4spEg7MO/vOrYRn1nsSipFdrI=; b=knEpBoys2iHWOyEVlZpKm/0pP4zK5RzayA47jmvUAJDvY6pz2MajZzFjx8l+8rLKrX BN2OewgtSODQVvWLHf4h2xiZqqc0qADHlMgFh+v0Gcq1LuJ6NXETntbdhEf7cKl628Uo UMphpWSE9azpE9VTWSEMCylFZZWLl4eTPYsWQd19o441RAmkQQQsYWp6SLlvVsEIe79H iLsj+uHbfM3Ode5G0DKnei19XBQZQpaCEq/L20ie+mbQ/SapSELOOJiOxA/2MEaRUJ8x ePCFwREVsLnMCnM6RTtIuzuCKlwmzghixoLyJTNkQFNEbfpADBuQXHBkOagA9CJ8gVYp AwMA== X-Gm-Message-State: APjAAAUYhia1s8OmTPdNmK93+fK41Esj6mbSiW3+FwwS3BuMmoOM+kxB jK4y2e6iVWASmhKgQEvmX8skhJ5Osjj8HotI1kvhkjb+ X-Google-Smtp-Source: APXvYqyYgk5fK+jz3oey8q6gQ5NT/75CHYyNVFqy9mWxJUFcDK6x2BdLC4qAXpDtu9wq+oRQss9GO/kXgpJhvaE3TVQ= X-Received: by 2002:a5d:9419:: with SMTP id v25mr16342084ion.3.1581491877499; Tue, 11 Feb 2020 23:17:57 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <5dfbef9f-754f-8487-a6b8-44296cba1a11@eastlink.ca> <171001115438.ZM17268@torch.brasslantern.com> <1506886188.3585120.1124265296.1C8585C6@webmail.messagingengine.com> <171001145042.ZM17810@torch.brasslantern.com> <16D1FF19-CE8F-4A88-9AD0-1661BC3FD65F@larryv.me> From: Mikael Magnusson Date: Wed, 12 Feb 2020 08:17:56 +0100 Message-ID: Subject: Re: What's wrong with PROMPT_SUBST? (Was: VCS info (Re: Call for good plugins list)) To: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 2/12/20, Bart Schaefer wrote: > On Tue, Feb 11, 2020 at 1:38 AM Lawrence Vel=C3=A1zquez wr= ote: >> >> > On Oct 1, 2017, at 5:50 PM, Bart Schaefer >> > wrote: >> > >> > The main thing is that I despise prompt_subst >> >> Why is that? > > Mostly it's a matter of taste. It introduces yet another set of > tokens that you have to escape to use literally in prompts, and I > don't think the prompt is an appropriate place to be running command > substitutions. It means even more possible collisions on variable > names with unintended side-effects. Obviously these are things that > can be avoided; I'd just rather not have to think about them. One particular cargo culted piece of setup is the following combo, setopt prompt_subst preexec() { print -P "$escape_to_set_terminal_title $1 $end_terminal_title" } which will result in the following command having funny results, echo '$(killall -9 zsh)' (the above code is wrong even without prompt_subst but the consequences are quite a bit worse with it). The easy fix with prompt_subst enabled is to use \$1 instead which should be more or less fine as long as you haven't literally typed in the $end_terminal_title code. --=20 Mikael Magnusson