zshrc: Include current directory in persistent dirstack
authorFrank Terbeck <ft@bewatermyfriend.org>
Wed, 8 Jul 2009 15:14:56 +0000 (17:14 +0200)
committerFrank Terbeck <ft@bewatermyfriend.org>
Wed, 8 Jul 2009 15:14:56 +0000 (17:14 +0200)
When we used 'dirs -p' for that feature, $PWD was included already.
It's not present in ${dirstack}, though. Now we just prepend $PWD to
$dirstack when writing it to .zdirs.

debian/changelog
etc/zsh/zshrc

index 30f05fd..2706b30 100644 (file)
@@ -12,12 +12,13 @@ grml-etc-core (0.3.73) UNRELEASED; urgency=low
   * zshrc: Set options a lot earlier and include noshwordsplit explicitly.
   * zshrc: Make functions insusceptible to user option settings.
   * zsh: move completion.d and functions.d to usr/share
+  * zshrc: Include the current directory in the persistent directory stack.
 
   [ Michael Prokop ]
   * zshrc: add deborphan, pal and hnb to compdef _gnu_generic. Thanks for
     the suggestion to Carsten Hey.
 
- -- Frank Terbeck <ft@grml.org>  Wed, 08 Jul 2009 13:33:56 +0200
+ -- Frank Terbeck <ft@grml.org>  Wed, 08 Jul 2009 17:11:46 +0200
 
 grml-etc-core (0.3.72) unstable; urgency=low
 
index f7c332b..c1a619f 100644 (file)
@@ -1064,10 +1064,12 @@ if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
 fi
 
 chpwd() {
+    local -ax my_stack
+    my_stack=( ${PWD} ${dirstack} )
     if is42 ; then
-        builtin print -l ${(u)dirstack} >! ${DIRSTACKFILE}
+        builtin print -l ${(u)my_stack} >! ${DIRSTACKFILE}
     else
-        uprint dirstack >! ${DIRSTACKFILE}
+        uprint my_stack >! ${DIRSTACKFILE}
     fi
 }