Function: ls-lisp-classify-file

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

Signature

(ls-lisp-classify-file FILENAME FATTR)

Documentation

Append a character to FILENAME indicating the file type.

This function puts the dired-filename property on FILENAME, but not on the character indicator it appends. FATTR is the file attributes returned by file-attributes for the file. The file type indicators are / for directories, @ for symbolic links, | for FIFOs, = for sockets, * for regular files that are executable, and nothing for other types of files.

Source Code

;; Defined in /usr/src/emacs/lisp/ls-lisp.el.gz
(defun ls-lisp-classify-file (filename fattr)
  "Append a character to FILENAME indicating the file type.

This function puts the `dired-filename' property on FILENAME, but
not on the character indicator it appends.
FATTR is the file attributes returned by `file-attributes' for the file.
The file type indicators are `/' for directories, `@' for symbolic
links, `|' for FIFOs, `=' for sockets, `*' for regular files that
are executable, and nothing for other types of files."
  (let* ((type (file-attribute-type fattr))
	 (modestr (file-attribute-modes fattr))
	 (typestr (substring modestr 0 1))
         (file-name (propertize filename 'dired-filename t)))
    (cond
     (type
      (concat file-name (if (eq type t) "/" "@")))
     ((string-match "x" modestr)
      (concat file-name "*"))
     ((string= "p" typestr)
      (concat file-name "|"))
     ((string= "s" typestr)
      (concat file-name "="))
     (t file-name))))