Function: eshell-ls-annotate
eshell-ls-annotate is a byte-compiled function defined in em-ls.el.gz.
Signature
(eshell-ls-annotate FILEINFO)
Documentation
Given a FILEINFO object, return a resolved, decorated FILEINFO.
This means resolving any symbolic links, determining what face the name should be displayed as, etc. Think of it as cooking a FILEINFO.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-ls.el.gz
(defun eshell-ls-annotate (fileinfo)
"Given a FILEINFO object, return a resolved, decorated FILEINFO.
This means resolving any symbolic links, determining what face the
name should be displayed as, etc. Think of it as cooking a FILEINFO."
(if (not (and (stringp (cadr fileinfo))
(or dereference-links
(eq listing-style 'long-listing))))
(setcar fileinfo (eshell-ls-decorated-name fileinfo))
(let (dir attr)
(unless (file-name-absolute-p (cadr fileinfo))
(setq dir (file-truename
(file-name-directory
(expand-file-name (car fileinfo))))))
(setq attr
(eshell-file-attributes
(let ((target (if dir
(expand-file-name (cadr fileinfo) dir)
(cadr fileinfo))))
(if dereference-links
(file-truename target)
target))))
(if (or dereference-links
(string-match "^\\.\\.?$" (car fileinfo)))
(progn
(setcdr fileinfo attr)
(setcar fileinfo (eshell-ls-decorated-name fileinfo)))
(cl-assert (eq listing-style 'long-listing))
(setcar fileinfo
(concat (eshell-ls-decorated-name fileinfo) " -> "
(eshell-ls-decorated-name
(cons (cadr fileinfo) attr)))))))
fileinfo)