From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6982 invoked by alias); 23 Jun 2017 20:08:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41350 Received: (qmail 6855 invoked from network); 23 Jun 2017 20:08:10 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f193.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.128.193):SA:0(-1.0/5.0):. Processed in 1.604447 secs); 23 Jun 2017 20:08:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: tamelingdaniel@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.128.193 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=hJXvzOVOVIvnqBaCxom27bInso/zscRRF1F2RYHzUOU=; b=jB/KX6EULgTBgPkpZaMKnd4eSZh3W5u5WavtkunoLpvtsxJRevQSGkstQOih56jiAR 5M/YqjlUdqtvQEE5nGkN+iRyWmaHUSfS06uNbTeuGdiAgDpmIsL9/1yrPIAm12p7nhOq BdiG5HY1YXQ/YegcAWR84jdwyKig0r4G+fwlvEa+jmyse/JuhW4Yjum/JO5urJI9cIHi LtjshSFYGxkU7hENdebYs7kVk2xMr4oMIbbcxsDtt/9XiRjvZrHF2wNJGQLOivoKJVMn N42zooPcTbdL/JqyNvcqoL1jMxuemrdlq5NwiUpQ0lcRDk1IGt60ZO3SH1xoP9pOXDhV GnqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=hJXvzOVOVIvnqBaCxom27bInso/zscRRF1F2RYHzUOU=; b=eTlLjlmTp2uiqyr6At7bqyFpehZhwsKKTNEwPy5dboStnCEb+oyecdeHLJHCxBLhDk 4YKdC6x2a1/CECUCLsoxuYJKpteYE421/TZkyGtgvBWyTXHTwqMpAIfOVcC8EUA4i5YK RFgOl6oeH7IH//HRkyrBCvywYX/sdf5MkZYo6gWs3y4pC4xqixYrAJVatzo8vL2Yz4VP AQ7pdwRoHYn19bRJ9RK1T/a2u58IfaT0PIGZPrIk/EdSnusefgFHcjqCGuR40SCq6MuD uzHXtNF7qmqlFkMcPV2SAysgALEl7miRvFlcaPBQ0a1GCbYbQId7CAj5rk5G0lfCfBdP 0UOQ== X-Gm-Message-State: AKS2vOyA+QijATFxbbRvoNGaGVOQ3D84XILADZPPvwCgrGBf/CCB1RKt PO+N5QU6Q2sIbjyu X-Received: by 10.28.72.7 with SMTP id v7mr6490880wma.125.1498248480621; Fri, 23 Jun 2017 13:08:00 -0700 (PDT) References: <170621101645.ZM9838@torch.brasslantern.com> <20170622101735.4ebebd11@pwslap01u.europe.root.pri> User-agent: mu4e 0.9.16; emacs 25.2.1 From: Daniel Tameling To: zsh-workers@zsh.org Cc: Subject: Re: When RPROMPT != RPS1 In-reply-to: <20170622101735.4ebebd11@pwslap01u.europe.root.pri> Date: Fri, 23 Jun 2017 22:07:57 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Peter Stephenson writes: > On Wed, 21 Jun 2017 10:16:45 -0700 > Bart Schaefer wrote: >> I don't have a good suggestion for how to satisfy both constraints. >> Anyone? The parameter initialization code has been broken up into >> a few more sections already, maybe there's a way to rearrange these >> as well. > > We can at least make it less likely people are going to trip over the > complications if they're simply using the prompt system. > > pws If I understand the problem correctly, the issue is not just limited to the right prompts. The different themes set different prompt variables, so when you change between themes you get a prompt setup that depends on the history of themes you used. For example, if I do autoload -Uz promptinit; promptinit prompt clint echo $PS3 I get ?# But if I do autoload -Uz promptinit; promptinit prompt adam1 prompt clint echo $PS3 I get %K{blue}%n@%m%k %B%F{green}%147<...<%~ %}%F{white} ?# %b%f%k Interestingly, there is no problem with the prompt functions like precmd, preexec etc. as the configuration of the previously active theme gets deleted in set_prompt right before the new theme is activated: local hook for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do add-zsh-hook -D "${hook}" "prompt_*_${hook}" done I think one solution for getting a consistent setup might be to add some code at the same place that restores the prompt variables to their default values. Maybe something along the lines of what I included below (which seems to solve the problem on my system). However, this breaks the bart theme as it has a mode of operation where one can set the right prompt before activating the theme. Best, Daniel diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit index 587248997..0bc9b1ab4 100644 --- a/Functions/Prompts/promptinit +++ b/Functions/Prompts/promptinit @@ -160,6 +160,11 @@ Use prompt -h for help on specific themes.' for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do add-zsh-hook -D "${hook}" "prompt_*_${hook}" done + PS1='%m%# ' + PS2='%_> ' + PS3='?# ' + PS4='+%N:%i> ' + unset RPROMPT RPS1 RPROMPT2 RPS2 typeset -ga zle_highlight=( ${zle_highlight:#default:*} ) (( ${#zle_highlight} )) || unset zle_highlight