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

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

Re: [h-e-w] UK date format in Dired


From: Eli Zaretskii
Subject: Re: [h-e-w] UK date format in Dired
Date: Sat, 27 Jan 2007 13:20:08 +0200

> Date: Sat, 27 Jan 2007 08:50:41 +0000
> From: "Graham Smith" <address@hidden>
> 
> Does Emacs32w control the date format in Dired?
> 
> I have two different approaches to changing the date format..
> 
> (setq ls-lisp-format-time-list
>        '("%d-%m-%Y %H:%M"
>          "%d-%m-%Y      "))
> 
> 
> or
> 
>  '(dired-listing-switches "-alD --time-style=locale")
> 
> neither of which are having any effect on the date format which is currently
> year month day, and I want it day month year.

Ah, I see the reason now.  Look at this part of the doc string of
ls-lisp-format-time-list:

    (defcustom ls-lisp-format-time-list
      '("%b %e %H:%M"
        "%b %e  %Y")
      "*List of `format-time-string' specs to display file time stamps.
    They are used whenever a locale is not specified to use instead.

See the last sentence? it really means what it says, as the code in
ls-lisp does this:

        ;; Use traditional time format in the C or POSIX locale,
        ;; ISO-style time format otherwise, so columns line up.
        (let ((locale system-time-locale))
          (if (not locale)
              (let ((vars '("LC_ALL" "LC_TIME" "LANG")))
                (while (and vars (not (setq locale (getenv (car vars)))))
                  (setq vars (cdr vars)))))
          (if (member locale '("C" "POSIX"))
              (setq locale nil))
          (format-time-string
           (if (and (<= past-cutoff diff) (<= diff 0))
               (if locale "%m-%d %H:%M" (nth 0 ls-lisp-format-time-list))
             (if locale "%Y-%m-%d " (nth 1 ls-lisp-format-time-list)))
           time))

And since the Windows port of Emacs always sets "LANG" to the current
Windows language identifier, we end up never using the value of
ls-lisp-format-time-list, but always use the ISO format instead.

The comment above says it's a feature: it makes the columns line up,
which would not be guaranteed if we used the localized format (since
the length of localized month names could be anything).




reply via email to

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