zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: Unset special parameters
Date: Mon, 10 Feb 2014 17:08:54 +0100	[thread overview]
Message-ID: <87vbwn9ch5.fsf@ft.bewatermyfriend.org> (raw)

Hi list,

Since commit f3e7cfe47c32a23, some special parameters are initialised to
be unset. Among them PS1 and RPS1. Which means that prompt-themes need
to mark these parameters as global, because otherwise shells running
with ‘warn_create_global’ set will complain.

When I was trying to do that in my own theme, I was first trying this
(quite simplified):

#+BEGIN_SRC shell-script
prompt_ft_precmd () {
    # ...
    typeset -g RPS1
    RPS1='foo'
    # ...
}
#+END_SRC

...which still triggers the warning. Only when I assign a value to RPS1
in the typeset call, the warning goes away:

#+BEGIN_SRC shell-script
prompt_ft_precmd () {
    # ...
    typeset -g RPS1='foo'
    # ...
}
#+END_SRC

Is this a bug? Because, if I do this with a non-special parameter, it
works the way I'd expect it to:

[snip]
zsh% foo () {
    typeset -g BAR
    BAR=thingy
}
zsh% foo
zsh% echo $BAR
thingy
[snap]


Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


             reply	other threads:[~2014-02-10 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 16:08 Frank Terbeck [this message]
2014-02-10 20:24 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbwn9ch5.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).