Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Strange prompting in new 3.1.5



"Zefram" wrote:
> Stucki wrote:
> >I installed the new Version 3.1.5 and since then my
> >(unchanged) 'prompt' always showed '~PWD' where '%~'
> >is expanded.
> 
> Basically, AUTO_NAME_DIRS is a really bad idea if you want to do
> %~ expansion.  Think about it: ~PWD is always a correct name for the
> directory you're in.  It's just not useful.  Even if we make an exception
> for PWD, there's nothing stopping other parameters being equally unhelpful
> (OLDPWD, and anything the user uses in the chpwd function).

But %~ doesn't use OLDPWD and users can make arrangments for their own
variables, whereas PWD is set by the shell and it's up to the shell to
make it useful.  I don't think it's good enough simply saying %~ and
autonamedirs are incompatible; that's the shell's fault, not the
user's.

*** Src/utils.c.pwd	Fri Oct 30 16:37:18 1998
--- Src/utils.c	Wed Nov  4 13:16:17 1998
***************
*** 510,515 ****
--- 510,519 ----
      if ((flags & ND_USERNAME) && nameddirtab->getnode2(nameddirtab, s))
  	return;
  
+     /* Never hash PWD, because it's never useful */
+     if (!strcmp(s, "PWD"))
+ 	return;
+ 
      /* Normal parameter assignments generate calls to this function, *
       * with always==0.  Unless the AUTO_NAME_DIRS option is set, we  *
       * don't let such assignments actually create directory names.   *

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author