# HG changeset patch # User Glenn Morris # Date 1289447944 28800 # Node ID 175c03267666a73d8a297224a4a7e23bc7d74b5b # Parent 721dbc4f6c02a0388eb25d4eef2fd8cefea02526 Minor ls-lisp changes. * lisp/ls-lisp.el (ls-lisp-ignore-case, ls-lisp-dirs-first) (ls-lisp-verbosity): Add custom :set-after property. (ls-lisp-verbosity, ls-lisp-use-localized-time-format): Doc fixes. (ls-lisp-format, ls-lisp-format-time): Don't take `now' as an argument. (ls-lisp-insert-directory): Update caller. diff -r 721dbc4f6c02 -r 175c03267666 lisp/ChangeLog --- a/lisp/ChangeLog Wed Nov 10 19:57:02 2010 -0800 +++ b/lisp/ChangeLog Wed Nov 10 19:59:04 2010 -0800 @@ -2,6 +2,12 @@ * obsolete/lucid.el: Don't warn about any CL functions in this file. + * ls-lisp.el (ls-lisp-ignore-case, ls-lisp-dirs-first) + (ls-lisp-verbosity): Add custom :set-after property. + (ls-lisp-verbosity, ls-lisp-use-localized-time-format): Doc fixes. + (ls-lisp-format, ls-lisp-format-time): Don't take `now' as an argument. + (ls-lisp-insert-directory): Update caller. + * play/landmark.el (lm-prompt-for-move): * play/gomoku.el (gomoku-prompt-for-move): Remove nonsensical code. diff -r 721dbc4f6c02 -r 175c03267666 lisp/ls-lisp.el --- a/lisp/ls-lisp.el Wed Nov 10 19:57:02 2010 -0800 +++ b/lisp/ls-lisp.el Wed Nov 10 19:59:04 2010 -0800 @@ -92,6 +92,7 @@ (or (memq ls-lisp-emulation '(MS-Windows MacOS)) (and (boundp 'ls-lisp-dired-ignore-case) ls-lisp-dired-ignore-case)) "Non-nil causes ls-lisp alphabetic sorting to ignore case." + :set-after '(ls-lisp-emulation) :type 'boolean :group 'ls-lisp) @@ -99,6 +100,7 @@ "Non-nil causes ls-lisp to sort directories first in any ordering. \(Or last if it is reversed.) Follows Microsoft Windows Explorer." ;; Functionality suggested by Chris McMahan + :set-after '(ls-lisp-emulation) :type 'boolean :group 'ls-lisp) @@ -114,14 +116,15 @@ A value of nil (or an empty list) means display none of them. Concepts come from UNIX: `links' means count of names associated with -the file\; `uid' means user (owner) identifier\; `gid' means group +the file; `uid' means user (owner) identifier; `gid' means group identifier. -If emulation is MacOS then default is nil\; +If emulation is MacOS then default is nil; if emulation is MS-Windows then default is `(links)' if platform is -Windows NT/2K, nil otherwise\; -if emulation is UNIX then default is `(links uid)'\; +Windows NT/2K, nil otherwise; +if emulation is UNIX then default is `(links uid)'; if emulation is GNU then default is `(links uid gid)'." + :set-after '(ls-lisp-emulation) ;; Functionality suggested by Howard Melman :type '(set (const :tag "Show Link Count" links) (const :tag "Show User" uid) @@ -157,7 +160,7 @@ Syntax: (EARLY-TIME-FORMAT OLD-TIME-FORMAT) The EARLY-TIME-FORMAT is used if file has been modified within the -current year. The OLD-TIME-FORMAT is used for older files. To use ISO +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 @@ -168,11 +171,11 @@ :group 'ls-lisp) (defcustom ls-lisp-use-localized-time-format nil - "Non-nil causes ls-lisp to use `ls-lisp-format-time-list' even if -a valid locale is specified. + "Non-nil means to always use `ls-lisp-format-time-list' for time stamps. +This applies even if a valid locale is specified. WARNING: Using localized date/time format might cause Dired columns -to fail to lign up, e.g. if month names are not all of the same length." +to fail to line up, e.g. if month names are not all of the same length." :type 'boolean :group 'ls-lisp) @@ -302,7 +305,6 @@ (if (memq ?n switches) 'integer 'string))) - (now (current-time)) (sum 0) (max-uid-len 0) (max-gid-len 0) @@ -373,7 +375,7 @@ sum (float sum)))) (insert (ls-lisp-format short attr file-size - switches time-index now)))) + switches time-index)))) ;; Insert total size of all files: (save-excursion (goto-char (car total-line)) @@ -412,7 +414,7 @@ (ls-lisp-classify-file file fattr) file) fattr (nth 7 fattr) - switches time-index (current-time))) + switches time-index)) (message "%s: doesn't exist or is inaccessible" file) (ding) (sit-for 2))))) ; to show user the message! @@ -585,10 +587,10 @@ (substring filename (1+ i) end)))) )) "\0" filename)) -(defun ls-lisp-format (file-name file-attr file-size switches time-index now) +(defun ls-lisp-format (file-name file-attr file-size switches time-index) "Format one line of long ls output for file FILE-NAME. FILE-ATTR and FILE-SIZE give the file's attributes and size. -SWITCHES, TIME-INDEX and NOW give the full switch list and time data." +SWITCHES and TIME-INDEX give the full switch list and time data." (let ((file-type (nth 0 file-attr)) ;; t for directory, string (name linked to) ;; for symbolic link, or nil. @@ -646,7 +648,7 @@ gid)))) (ls-lisp-format-file-size file-size (memq ?h switches)) " " - (ls-lisp-format-time file-attr time-index now) + (ls-lisp-format-time file-attr time-index) " " (if (not (memq ?F switches)) ; ls-lisp-classify already did that (propertize file-name 'dired-filename t) @@ -664,14 +666,13 @@ ((memq ?t switches) 5) ; last modtime ((memq ?u switches) 4))) ; last access -(defun ls-lisp-format-time (file-attr time-index now) +(defun ls-lisp-format-time (file-attr time-index) "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. +depending on distance between file date and the current time. 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 (- (float-time time) - (float-time now))) + (diff (- (float-time time) (float-time))) ;; 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.