[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ls-lisp: recognise symlinked dirs as dirs when sorting [patch]

From: Vivek
Subject: ls-lisp: recognise symlinked dirs as dirs when sorting [patch]
Date: Mon, 14 Jul 2003 16:09:35 +0100 (BST)

In GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2003-06-06 on arachne, modified by Debian
configured using `configure  i386-linux --prefix=/usr \
  --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib \
  --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes \
  --with-x=yes --with-x-toolkit=athena --without-gif'

ls-lisp-handle-switches doesn't realize my automounted ( and
therefore symlinked ) home directory is a directory, and so
sorts "." and ".." incorrectly at the first two levels:

[ eg one level down in ~/tmp, ".." is at the end of the block of
  directories, not at the top after "." ]

--- dist/ls-lisp.el     Wed Dec  4 12:38:27 2002
+++ patched/ls-lisp.el  Mon Jul 14 15:46:44 2003
@@ -384,9 +384,13 @@
   ;; ordering, and reverse whole list.  cadr of each element of
   ;; `file-alist' is t for directory, string (name linked to) for
   ;; symbolic link, or nil.
-      (let (el dirs files)
+      (let (el dirs files dir-or-link)
        (while file-alist
-         (if (eq (cadr (setq el (car file-alist))) t) ; directory
+          (setq el          (car  file-alist)
+                dir-or-link (cadr el        ))
+         (if (and dir-or-link
+                   (or (eq dir-or-link   t)             ; directory
+                       (file-directory-p dir-or-link))) ; symlink to dir
              (setq dirs (cons el dirs))
            (setq files (cons el files)))
          (setq file-alist (cdr file-alist)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]