Function: ls-lisp-sanitize

ls-lisp-sanitize is a byte-compiled function defined in ls-lisp.el.gz.

Signature

(ls-lisp-sanitize FILE-ALIST)

Documentation

Sanitize the elements in FILE-ALIST.

Fixes any elements in the alist for directory entries whose file attributes are nil (meaning that file-attributes failed for them). This is known to happen for some network shares, in particular for the ".." directory entry.

If the ".." directory entry has nil attributes, the attributes are copied from the "." entry, if they are non-nil. Otherwise, the offending element is removed from the list, as are any elements for other directory entries with nil attributes.

Source Code

;; Defined in /usr/src/emacs/lisp/ls-lisp.el.gz
(defun ls-lisp-sanitize (file-alist)
  "Sanitize the elements in FILE-ALIST.
Fixes any elements in the alist for directory entries whose file
attributes are nil (meaning that `file-attributes' failed for
them).  This is known to happen for some network shares, in
particular for the \"..\" directory entry.

If the \"..\" directory entry has nil attributes, the attributes
are copied from the \".\" entry, if they are non-nil.  Otherwise,
the offending element is removed from the list, as are any
elements for other directory entries with nil attributes."
  (if (and (consp (assoc ".." file-alist))
           (null (cdr (assoc ".." file-alist)))
	   (cdr (assoc "." file-alist)))
      (setcdr (assoc ".." file-alist) (cdr (assoc "." file-alist))))
  (rassq-delete-all nil file-alist))