Function: trashed-file-info
trashed-file-info is a natively compiled function defined in
trashed.el.
Signature
(trashed-file-info FILE ATTRS)
Documentation
Return a list of a trash file's id and descs for tabulated-list-entries.
FILE and ATTRS are file and attributes of the trash file.
Source Code
;; Defined in /nix/store/7ppdacjhnynz276lxxnfw8sdz6r2k6h2-emacs-packages-deps/share/emacs/site-lisp/elpa/trashed-20230811.157/trashed.el
(defun trashed-file-info (file attrs)
"Return a list of a trash file's id and descs for `tabulated-list-entries'.
FILE and ATTRS are file and attributes of the trash file."
(if (if (eq system-type 'windows-nt)
(string-match "[^:]/\\$R[^/]+$" file)
(not (or (string= file ".") (string= file ".."))))
(let ((info-file (trashed-info-file file)))
(if (or (and (not (file-directory-p info-file))
(file-readable-p info-file))
;; Workaround for info files generated by Emacs bug #37922
(and (not (eq system-type 'windows-nt))
(setq info-file (expand-file-name file trashed-info-dir))
(not (file-directory-p info-file))
(file-readable-p info-file)))
(let* ((trashinfo (trashed-read-trashinfo info-file))
(sizenum (nth 0 trashinfo))
(datenum (nth 1 trashinfo))
(pathstr (nth 2 trashinfo)))
(if (and datenum pathstr)
(let ((type (substring (nth 8 attrs) 0 1)) ;; type
(size (number-to-string (or sizenum ;; windows-nt
(nth 7 attrs)))) ;; size
(date (format "%07d %05d"
(car datenum) (cadr datenum)))
(name (propertize pathstr 'mouse-face 'highlight)))
;; Add up trash can size
(setq trashed-trash-can-size (+ trashed-trash-can-size
(string-to-number size)))
;; Lengthen column width if needed
(trashed-update-col-width
1 (string-width (trashed-format-size-string size)))
(trashed-update-col-width
2 (string-width (trashed-format-date-string date)))
(trashed-update-col-width
3 (string-width name))
;; File info
(list file (vector type size date name)))
(message "Skipped %s: cannot recognize info file format." file)
nil))
(message "Skipped %s: cannot find or read info file." file)
nil))))