From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11282 invoked by alias); 5 Jan 2012 16:30:36 -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: 30085 Received: (qmail 16232 invoked from network); 5 Jan 2012 16:30:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.213.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:date:from:to:message-id:subject:x-mailer:mime-version :content-type; bh=zuzf1tZrJZThFf+eZEI6Tx20e/TmuCIfhWHPW6W1Ja0=; b=vuYRiYO5QrF5m/4MypXHsCSJw45kLouwXNqBYhYQ6osxUzmfC8IH/vexdbEmZ8D2N4 SoIG0j5koRVGiB99ow0B/nf3owqhfhZdZIgPcaDzdxhMPWDs8YD5jLj39+aFLLpV82X0 tvpXW6eZk/4fJOaGcUwN4RgqZEy3P57MuzhSk= Sender: =?UTF-8?Q?Christian_H=C3=B6ltje?= Date: Thu, 5 Jan 2012 11:23:16 -0500 From: =?utf-8?Q?Christian_H=C3=B6ltje?= To: zsh-workers@zsh.org Message-ID: Subject: Teardown for prompts X-Mailer: sparrow 1.5 (build 1043.1) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="4f05ce74_1ba026fa_d01" --4f05ce74_1ba026fa_d01 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I have some suggestions for the promptinit stuff.... =20 1) Remove other prompt related hooks. Currently, it removes preexec and = precmd, but it doesn't remove chpwd, periodic, zshexit, nor zshaddhistory= . e.g. for hook in preexec precmd chpwd periodic zshexit zshaddhistory; do add-zsh-hook -D =22=24=7Bhook=7D=22 =22prompt=5F*=5F=24=7Bhook=7D= =22 done Bonus points for getting the list of hooks from add-zsh-hook itself.= 2) Add a teardown function. This could be used to unset things, etc. if= the prompt changes. If prompt is switching from the prompt 'adam2', it = would look for prompt=5Fadam2=5Fteardown and run it if it exists before s= witch to the new prompt. 3) On switching away from a prompt, look for any and all variables and f= unctions with pattern =22prompt=5F=24=7Bcurrent=5Fprompt=5Fname=7D=5F*=22= and unset/unfunction them. I discovered this when I wrote a prompt that used the chpwd hook to try t= o minimize certain VCS checks (an optimization) and that function was sti= ll being called when I switched to a new prompt. =20 -- =20 Christian H=C3=B6ltje docwhat=40gerf.org http://docwhat.org/ --4f05ce74_1ba026fa_d01--