zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Peter Whaite <peta@cortexmachina.com>, zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Prompt %~ (sometimes) expands /local/src/zsh to ~unambiguous
Date: Wed, 28 Jun 2000 17:05:34 +0000	[thread overview]
Message-ID: <1000628170534.ZM32412@candle.brasslantern.com> (raw)
In-Reply-To: <200006281448.KAA14282@ursula.cortexmachina.com>
In-Reply-To: <200006281455.QAA03002@beta.informatik.hu-berlin.de>

On Jun 28, 10:48am, Peter Whaite wrote:
} 
} I have noticed that every now and then `print -P "%~"` prints "~unambiguous".

On Jun 28,  4:55pm, Sven Wischnowsky wrote:
}
} Haven't investigated any further... the $compstate assoc contains an
} element `unambiguous'. Maybe one of the recent changes to the
} parameter code...?

I don't know if it's one of the recent changes, but that does appear to
be the problem:

zagzig% setopt autonamedirs
zagzig% typeset -A foo
zagzig% foo[bar]=$PWD
zagzig% print -P %~
~bar

} And maybe we should add code to prevent the automatic name-dir
} behaviour for assoc elements anyway (if we don't have that already and 
} this is really the cause).

Actually, I have a longstanding request that ~foo[bar] should work ...
but that means changing the parser ...

Certainly assigning to foo[bar] shouldn't define ~bar.

Index: Src/params.c
===================================================================
@@ -2020,6 +2020,7 @@
 	oldpm = pm->old;
 	paramtab->addnode(paramtab, oldpm->nam, oldpm);
 	if ((PM_TYPE(oldpm->flags) == PM_SCALAR) &&
+	    !(pm->flags & PM_HASHELEM) &&
 	    oldpm->sets.cfn == strsetfn)
 	    adduserdir(oldpm->nam, oldpm->u.str, 0, 0);
 	if (oldpm->flags & PM_EXPORTED) {
@@ -2104,7 +2105,8 @@
 {
     zsfree(pm->u.str);
     pm->u.str = x;
-    adduserdir(pm->nam, x, 0, 0);
+    if (!(pm->flags & PM_HASHELEM))
+	adduserdir(pm->nam, x, 0, 0);
 }
 
 /* Function to get value of an array parameter */

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


      reply	other threads:[~2000-06-28 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-28 14:48 Peter Whaite
2000-06-28 14:55 ` Sven Wischnowsky
2000-06-28 17:05   ` Bart Schaefer [this message]

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=1000628170534.ZM32412@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=peta@cortexmachina.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).