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

Re: Recent directory tweaks



On Thu, 15 Jul 2010 21:26:05 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> Point out in the documentation for people who aren't hardcore completion
> system users that it's possible to get a different set of recent
> directories in different locations.  Actually, I think this gets
> polluted by the handling for $OLDPWD in chpwd_recent_dirs, i.e. the
> directory you've come from may get added even if, if you were in it,
> you'd use a different file, but I'll look at that another time.

I think the answer is that's an unnecessary complexity anyway.  It's
enough to record directories you actually changed to, not ones you've
come from.  Most of the time this just means you don't put ~ in the list
when the shell started there.  I think.

Index: Functions/Chpwd/chpwd_recent_dirs
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Chpwd/chpwd_recent_dirs,v
retrieving revision 1.1
diff -p -u -r1.1 chpwd_recent_dirs
--- Functions/Chpwd/chpwd_recent_dirs	9 Jul 2010 14:47:48 -0000	1.1
+++ Functions/Chpwd/chpwd_recent_dirs	20 Jul 2010 19:00:21 -0000
@@ -38,11 +38,6 @@ fi
 chpwd_recent_filehandler
 
 if [[ $reply[1] != $PWD ]]; then
-  if [[ -n $OLDPWD && $reply[1] != $OLDPWD ]]; then
-    # The first time we change directory we probably don't have
-    # the initial directory.
-    chpwd_recent_add $OLDPWD && changed=1
-  fi
   chpwd_recent_add $PWD && changed=1
 
   (( changed )) && chpwd_recent_filehandler $reply

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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