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

Re: PATCH: option for completion file-sort to follow symlinks



My initial patch broke completing cd into a symbolic link pointing to
the directory (if sorting with follow was turned on).  That is because
for cd completion final flags are (-/) and with sorting set to "date
follow" flags were becoming "(-om-/)" thus 2nd dash was turning
following links off.

Correction below: make sort-files follow option restore the
follow-links qualifier to initial state:

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.33
diff -u -r1.33 _path_files
--- Completion/Unix/Type/_path_files	29 Jul 2008 08:39:42 -0000	1.33
+++ Completion/Unix/Type/_path_files	30 Jul 2008 13:32:08 -0000
@@ -123,7 +123,7 @@
   *)                  sort=on;;
   esac
   [[ "$tmp1" = *rev* ]] && sort[1]=O
-  [[ "$tmp1" = *follow* ]] && sort="-$sort"
+  [[ "$tmp1" = *follow* ]] && sort="-${sort}-"
 
   if [[ "$sort" = on ]]; then
     sort=

At Tue, 29 Jul 2008 09:39:44 +0100,
Peter Stephenson wrote:
> 
> Max Mikhanosha wrote:
> > The one line patch included into the end of this email adds one
> > additional option `follow' to the file-sort, which makes it follow
> > symlinks.
> 
> Thanks, I've committed this with some documentation.
> 
> Index: Doc/Zsh/compsys.yo
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
> retrieving revision 1.212
> diff -u -u -r1.212 compsys.yo
> --- compsys.yo	14 Jul 2008 17:39:26 -0000	1.212
> +++ compsys.yo	29 Jul 2008 08:38:41 -0000
> @@ -1494,7 +1494,10 @@
>  `tt(inode)' (or `tt(change)') to sort by the last inode change
>  time.  If the style is set to any other value, or is unset, files will be
>  sorted alphabetically by name.  If the value contains the string
> -`tt(reverse)', sorting is done in the opposite order.
> +`tt(reverse)', sorting is done in the opposite order.  If the value
> +contains the string `tt(follow)', timestamps are associated with the
> +targets of symbolic links; the default is to use the timestamps
> +of the links themselves.
>  )
>  kindex(filter, completion style)
>  item(tt(filter))(
> 
> -- 
> Peter Stephenson <pws@xxxxxxx>                  Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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