Commit b3e22bd4 authored by Glenn Morris's avatar Glenn Morris
Browse files

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.
parent 55a4b4fe
......@@ -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.
 
......
......@@ -92,6 +92,7 @@ option will have no effect until you restart Emacs."
(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 @@ option will have no effect until you restart Emacs."
"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 <cmcmahan@one.net>
:set-after '(ls-lisp-emulation)
:type 'boolean
:group 'ls-lisp)
......@@ -114,14 +116,15 @@ It should contain none or more of the symbols: links, uid, gid.
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 <howard@silverstream.com>
:type '(set (const :tag "Show Link Count" links)
(const :tag "Show User" uid)
......@@ -157,7 +160,7 @@ regardless of whether the locale can be determined.
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 @@ current year. The OLD-TIME-FORMAT is used for older files. To use ISO
: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 @@ not contain `d', so that a full listing is expected."
(if (memq ?n switches)
'integer
'string)))
(now (current-time))
(sum 0)
(max-uid-len 0)
(max-gid-len 0)
......@@ -373,7 +375,7 @@ not contain `d', so that a full listing is expected."
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 @@ not contain `d', so that a full listing is expected."
(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 @@ FOLLOWED by null and full filename, SOLELY for full alpha sort."
(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 @@ SWITCHES, TIME-INDEX and NOW give the full switch list and time data."
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 @@ Return nil if no time switch found."
((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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment