bug-gnu-emacs
[Top][All Lists]
Advanced

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

[patch] 21.1 CVS ls-lisp.el -- Correct dired listing in w2k


From: Jari Aalto+mail.emacs
Subject: [patch] 21.1 CVS ls-lisp.el -- Correct dired listing in w2k
Date: Sat, 05 Jan 2002 18:23:19 +0200
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/20.7 (i386-*-nt5.0.2195) (i386-*-nt5.0.2195)

    Here is patch to correct the dired time listing in w2k,
    as recently discussed with the strftime problem.

    Btw, the YYYY-MM-DD display is good one in the latest CVS version.
    I would even suggest to make it default in next Emacs...

    Jari

2002-01-05 Sat  Jari Aalto  <address@hidden>

        * ls-lisp.el (ls-lisp-format-time): W2k stftime does not
        return 3-character Month names: `format-time-string' %b will
        yield incorrect value. This causes dired listing 'not to line up'.
        Added `substring' to cut the month to 3 character.
        Added %S seconds display to YYYY-MM-DD notation
        for newer files.

//address@hidden /usr/src/cvs-source/emacs/lisp $ cvs diff -c ls-lisp.el
Index: ls-lisp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ls-lisp.el,v
retrieving revision 1.42
diff -u -IId: -c -r1.42 ls-lisp.el
cvs server: conflicting specifications of output style
*** ls-lisp.el  30 Dec 2001 17:04:26 -0000      1.42
--- ls-lisp.el  5 Jan 2002 16:10:16 -0000
***************
*** 532,537 ****
--- 532,538 ----
       (cadr time)
       (/ (or (nth 2 time) 0) 1000000.0)))
  
+ 
  (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,
***************
*** 555,566 ****
                  (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" "%b %e %H:%M")
!            (if locale "%Y-%m-%d " "%b %e  %Y"))
!          time))
        (error "Unk  0  0000"))))
  
  (provide 'ls-lisp)
  
--- 556,577 ----
                  (setq vars (cdr vars)))))
          (if (member locale '("C" "POSIX"))
              (setq locale nil))
!         (if (and (<= past-cutoff diff) (<= diff 0))
!             (if locale
!                 (format-time-string "%m-%d %H:%M:%S" time)
!               (concat
!                ;;  It's unfortunate, that `strftime' down not return
!                ;;  3-character month abbreviation in w32 system.
!                ;;  We cut the month here if the Month here manually.
!                (substring (format-time-string "%b" time) 0 3)
!                (format-time-string " %e %H:%M:%S" time)))
!           (if locale
!               (format-time-string "%Y-%m-%d    " time)
!             (concat
!              (substring (format-time-string "%b" time) 0 3)
!              (format-time-string " %e  %Y" time)))))
        (error "Unk  0  0000"))))
+ 
  
  (provide 'ls-lisp)



reply via email to

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