help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] Odd dired date format


From: Geert Ribbers
Subject: Re: [h-e-w] Odd dired date format
Date: Fri, 6 Sep 2002 14:05:12 +0200

Hi.

The function that arranges this is copied below.
There is no way to influence this behavior (other than overwriting the
function in your .emacs), it's hardcoded.
It would probably be a good idea if the authors would introduce a
custom-variable for it (authors copied).

Regards, Geert Ribbers
:
(defun ls-lisp-format-time (file-attr time-index now)
  "Format time for file with attributes FILE-ATTR according to TIME-INDEX.
Use the same method as ls to decide whether to show time-of-day or year,
depending on distance between file date and NOW.
All ls time options, namely c, t and u, are handled."
  (let* ((time (nth (or time-index 5) file-attr)) ; default is last modtime
         (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
         (future-cutoff (* 60 60)))             ; 1 hour
    (condition-case nil
        (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))))
             "%b %e %H:%M"
           "%b %e  %Y")
         time)
      (error "Unk  0  0000"))))


--__--__--

 Message: 5
To: address@hidden
Subject: Re: [h-e-w] Odd dired date format
From: David Vanderschel <address@hidden>
Date: 05 Sep 2002 15:14:16 -0500

On Thursday, September 05, "Windhorn, Allen, E. [LS/MKT]"
<address@hidden> wrote:
>Using dired to compare two directories, I noticed
>that the date format was different depending on the
>date of the file, in that the year was shown in some
>cases, but in others, it was replaced by the time.
>...

I always regarded this as a feature!  Older files show
the year.  If the file is less than 6 months old, the
time is shown, as a time distinction may be relevant
for recent files.

>I have just installed V21.2, and I haven't changed
>the default format in any way.  Is there a way to fix
>this?

No doubt the 6-month limit occurs somewhere as an
explicit parameter.

Regards,
  David V.












reply via email to

[Prev in Thread] Current Thread [Next in Thread]