diff options
Diffstat (limited to 'lisp/find-lisp.el')
-rw-r--r-- | lisp/find-lisp.el | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el index b356a74619c..073e2bc573f 100644 --- a/lisp/find-lisp.el +++ b/lisp/find-lisp.el @@ -300,24 +300,24 @@ It is a function which takes two arguments, the directory and its parent." "Format one line of long ls output for file FILE-NAME. FILE-ATTR and FILE-SIZE give the file's attributes and size. SWITCHES and TIME-INDEX give the full switch list and time data." - (let ((file-type (nth 0 file-attr))) + (let ((file-type (file-attribute-type file-attr))) (concat (if (memq ?i switches) ; inode number - (format "%6d " (nth 10 file-attr))) + (format "%6d " (file-attribute-inode-number file-attr))) ;; nil is treated like "" in concat (if (memq ?s switches) ; size in K - (format "%4d " (1+ (/ (nth 7 file-attr) 1024)))) - (nth 8 file-attr) ; permission bits + (format "%4d " (1+ (/ (file-attribute-size file-attr) 1024)))) + (file-attribute-modes file-attr) (format " %3d %-8s %-8s %8d " - (nth 1 file-attr) ; no. of links - (if (numberp (nth 2 file-attr)) - (int-to-string (nth 2 file-attr)) - (nth 2 file-attr)) ; uid + (file-attribute-link-number file-attr) + (if (numberp (file-attribute-user-id file-attr)) + (int-to-string (file-attribute-user-id file-attr)) + (file-attribute-user-id file-attr)) (if (eq system-type 'ms-dos) "root" ; everything is root on MSDOS. - (if (numberp (nth 3 file-attr)) - (int-to-string (nth 3 file-attr)) - (nth 3 file-attr))) ; gid - (nth 7 file-attr) ; size in bytes + (if (numberp (file-attribute-group-id file-attr)) + (int-to-string (file-attribute-group-id file-attr)) + (file-attribute-group-id file-attr))) + (file-attribute-size file-attr) ) (find-lisp-format-time file-attr switches now) " " @@ -342,16 +342,11 @@ list of ls option letters of which c and u are recognized). Use the same method as \"ls\" to decide whether to show time-of-day or year, depending on distance between file date and NOW." (let* ((time (nth (find-lisp-time-index switches) file-attr)) - (diff16 (- (car time) (car now))) - (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now))))) - (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months + (diff (encode-time (time-subtract time now) 'integer)) + (past-cutoff -15778476) ; 1/2 of a Gregorian year (future-cutoff (* 60 60))) ; 1 hour (format-time-string - (if (and - (<= past-cutoff diff) (<= diff future-cutoff) - ;; Sanity check in case `diff' computation overflowed. - (<= (1- (ash past-cutoff -16)) diff16) - (<= diff16 (1+ (ash future-cutoff -16)))) + (if (<= past-cutoff diff future-cutoff) "%b %e %H:%M" "%b %e %Y") time))) |