zsh-workers
 help / color / mirror / code / Atom feed
* Strange prompting in new 3.1.5
@ 1998-11-04 11:44 Stucki
  1998-11-04 12:03 ` Bruce Stephens
  1998-11-04 12:27 ` Zefram
  0 siblings, 2 replies; 6+ messages in thread
From: Stucki @ 1998-11-04 11:44 UTC (permalink / raw)
  To: zsh-workers

Hi!

I installed the new Version 3.1.5 and since then my
(unchanged) 'prompt' always showed '~PWD' where '%~'
is expanded. (I have PROMPTSUBST on because of a variable
'$SML' in the prompt, and the prompt is:

	%U(%BSt%b%U${SML})@%M:[%h](%u%B^:%~%b%U)>%u

I found out I can 'fix' this Problem by
putting 'unhash -d -m PWD' into 'precmd-function,
(I use '-m' to get no error if PWD is not yet set).

Is the new behaviour 'correct', or did somebody
reorganize something 'too correct to work with'
(like the search for Named-Dirs now including PWD)
Maybe it's a feature? (or my misconception :-)

Stucki

-- 
Christoph von Stuckrad       * *  | talk to  | <stucki@math.fu-berlin.de> \
Freie Universitaet Berlin    |/_* | nickname | Tel(days):+49 30 838-75 459 |
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel(else):+49 30 77 39 6600 |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax(allw):+49 30 838-75454 /


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strange prompting in new 3.1.5
  1998-11-04 11:44 Strange prompting in new 3.1.5 Stucki
@ 1998-11-04 12:03 ` Bruce Stephens
  1998-11-04 12:27 ` Zefram
  1 sibling, 0 replies; 6+ messages in thread
From: Bruce Stephens @ 1998-11-04 12:03 UTC (permalink / raw)
  To: zsh-workers

Stucki <stucki@petzval.math.fu-berlin.de> writes:

> I installed the new Version 3.1.5 and since then my (unchanged)
> 'prompt' always showed '~PWD' where '%~' is expanded.

Yes, I think it's a bug.  It might be logical, but it's clearly not
useful!  I fixed it by switching off autonamedirs, but your use of
hash is probably a better workaround.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH: Re: Strange prompting in new 3.1.5
  1998-11-04 12:27 ` Zefram
@ 1998-11-04 12:26   ` Peter Stephenson
  1998-11-04 16:21     ` Bart Schaefer
  1998-11-10 10:19     ` PATCH: 3.1.5: alternative PWD patch Peter Stephenson
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Stephenson @ 1998-11-04 12:26 UTC (permalink / raw)
  To: Zsh hackers list

"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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strange prompting in new 3.1.5
  1998-11-04 11:44 Strange prompting in new 3.1.5 Stucki
  1998-11-04 12:03 ` Bruce Stephens
@ 1998-11-04 12:27 ` Zefram
  1998-11-04 12:26   ` PATCH: " Peter Stephenson
  1 sibling, 1 reply; 6+ messages in thread
From: Zefram @ 1998-11-04 12:27 UTC (permalink / raw)
  To: real-stucki; +Cc: zsh-workers

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).

-zefram


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Strange prompting in new 3.1.5
  1998-11-04 12:26   ` PATCH: " Peter Stephenson
@ 1998-11-04 16:21     ` Bart Schaefer
  1998-11-10 10:19     ` PATCH: 3.1.5: alternative PWD patch Peter Stephenson
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 1998-11-04 16:21 UTC (permalink / raw)
  To: zsh-workers

On Nov 4, 12:44pm, Stucki wrote:
} Subject: Strange prompting in new 3.1.5
}
} I installed the new Version 3.1.5 and since then my
} (unchanged) 'prompt' always showed '~PWD' where '%~'
} is expanded.

This changed because PWD was "special" before 3.1.5, but became an
ordinary parameter in 3.1.5.  When it was "special" it never got
added to the named directory hash table.

On Nov 4,  1:26pm, Peter Stephenson wrote:
} Subject: PATCH: Re: Strange prompting in new 3.1.5
}
} "Zefram" wrote:
} > 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.

I have to agree with Peter here.  The shell shouldn't be screwing up its
own features.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH: 3.1.5: alternative PWD patch
  1998-11-04 12:26   ` PATCH: " Peter Stephenson
  1998-11-04 16:21     ` Bart Schaefer
@ 1998-11-10 10:19     ` Peter Stephenson
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 1998-11-10 10:19 UTC (permalink / raw)
  To: Zsh hackers list

I wrote:
> +     /* Never hash PWD, because it's never useful */

Bart pointed out to me that if the user explicitly uses ~PWD or `hash
-d PWD', they should get what they ask for.  Here's an alternative
patch for that:  now PWD is simply never added automatically.  The
only use I can think of is completion of ~PWD to get an absolute path
to the current directory on the command line.

Another strategy would be to hash it anyway, but simply never use it
if the destination is %~.  This is getting a little tricky.

*** Src/utils.c.pwd	Fri Oct 30 16:37:18 1998
--- Src/utils.c	Tue Nov 10 11:09:13 1998
***************
*** 510,515 ****
--- 510,519 ----
      if ((flags & ND_USERNAME) && nameddirtab->getnode2(nameddirtab, s))
  	return;
  
+     /* Never hash PWD unless it was explicitly requested */
+     if (!always && !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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-11-10 10:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-04 11:44 Strange prompting in new 3.1.5 Stucki
1998-11-04 12:03 ` Bruce Stephens
1998-11-04 12:27 ` Zefram
1998-11-04 12:26   ` PATCH: " Peter Stephenson
1998-11-04 16:21     ` Bart Schaefer
1998-11-10 10:19     ` PATCH: 3.1.5: alternative PWD patch Peter Stephenson

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).