[Top][All Lists]

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

cvs: ls-lisp-format-time

From: Peter Lee
Subject: cvs: ls-lisp-format-time
Date: Tue, 02 Sep 2003 11:38:05 -0500
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt)

(setq ls-lisp-format-time-list (quote ("%b %e %Y %H:%M" "%b %e %Y

was having no effect when I did 'C-x d'.

I looked at defun ls-lisp-format-time in ls-lisp.el and locale was
never nil so it was always using the hardcoded formats:

(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
         (diff (- (ls-lisp-time-to-seconds time)
                  (ls-lisp-time-to-seconds now)))
         ;; Consider a time to be recent if it is within the past six
         ;; months.  A Gregorian year has 365.2425 * 24 * 60 * 60 ==
         ;; 31556952 seconds on the average, and half of that is 15778476.
         ;; Write the constant explicitly to avoid roundoff error.
         (past-cutoff -15778476)) ; half a Gregorian year
    (condition-case nil
        ;; 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))
           (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)))
      (error "Unk  0  0000"))))

system-local-time == nil

          (if (member locale '("C" "POSIX"))
          (if (member locale '("C" "POSIX" "ENU"))

solves the problem and it correctly picks up my format strings, but I
don't really understand why it's looking at those environment
variables to begin with, so I've got this in as a temporary hack.


In GNU Emacs (i386-msvc-nt5.1.2600)
 of 2003-08-29 on PONGMASTER
configured using `configure --with-msvc (12.00) --cflags -Ie:/gnuwin32/include 
--ldflags /LIBPATH:e:/gnuwin32/lib'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-c 
C-b C-n C-p M-x e m a c s SPC r e p <backspace> <backspace> 
<backspace> b u g <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> b u g <backspace> C-g M-x a p r o p o s 
<return> b u g <return> C-x o C-s r e p o r t C-s C-s 
C-s C-s C-s C-s C-a C-x o C-x 1 M-x r e p o r t <r

Recent messages:
Loading cl-macs...done
Loading bytecomp...done
Compiling e:/cvs/emacs/lisp/ls-lisp.el...
Loading byte-opt...done
Compiling e:/cvs/emacs/lisp/ls-lisp.el...done
Wrote e:/cvs/emacs/lisp/ls-lisp.elc
Loading apropos...done
Mark saved where search started
Loading emacsbug...done

reply via email to

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