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

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

[patch] Emacs 21.2 ls-lisp does not allow custom time formats


From: Jari Aalto+mail.emacs
Subject: [patch] Emacs 21.2 ls-lisp does not allow custom time formats
Date: Mon, 19 Aug 2002 13:05:21 +0300
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-*-nt5.0.2195) (i386-*-nt5.0.2195)

    It's very unfortunate for ls-lisp.el to use localized time
    strings, because this completely garbles the dired output to
    unreadable "ragged" layout. In Finland (and in numerous other
    countries) the month names cannot be abbreviated into 3 letters,
    as in English.
    
    Here is patch to allow custom time formats. Personally I use
    ISO 8601. Why not set it default as well?

    Jari

--- ls-lisp.el.orig     2002-08-19 12:55:28.000000000 +0300
+++ ls-lisp.el  2002-08-19 13:02:30.000000000 +0300
@@ -144,6 +144,26 @@
   :type 'boolean
   :group 'ls-lisp)
 
+(defcustom ls-lisp-format-time-list
+  '("%b %e %H:%M"
+    "%b %e  %Y")
+  "*List of `format-time-string' specs to display file time stamps.
+
+Syntax:
+
+ '(EARLY-TIME-FORMAT
+   OLD-TIME-FORMAT)
+
+The EARLY-TIME-FORMAT is displayed, if file has been modified
+within the current year. The OLD-TIME-FORMAT is used for older files.
+To use ISO 8601 dates, you could set:
+
+\(setq ls-lisp-format-time-list
+       '(\"%Y-%m-%d %H:%M\"
+         \"%Y-%m-%d      \"))"
+  :type  '(list string)
+  :group 'ls-lisp)
+
 ;; Remember the original insert-directory function
 (or (featurep 'ls-lisp)  ; FJW: unless this file is being reloaded!
     (fset 'original-insert-directory (symbol-function 'insert-directory)))
@@ -532,8 +552,8 @@
              ;; 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")
+            (nth 0 ls-lisp-format-time-list)
+          (nth 1 ls-lisp-format-time-list))
         time)
       (error "Unk  0  0000"))))
 




reply via email to

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