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

PATCH: 3.1.5: alternative PWD patch

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))
+     /* 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@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