--- ls-lisp.el.orig 2009-06-21 13:37:45.000000000 +0900 +++ ls-lisp.el 2010-03-07 11:09:33.595406400 +0900 @@ -196,6 +196,9 @@ (or (featurep 'ls-lisp) ; FJW: unless this file is being reloaded! (setq original-insert-directory (symbol-function 'insert-directory))) +;;(defalias 'ls-lisp-version-lessp 'string-version-lessp) +(defalias 'ls-lisp-version-lessp 'string-logical-lessp) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -493,6 +496,32 @@ (error (message "Unsorted (ls-lisp sorting error) - %s" (error-message-string err)) (ding) (sit-for 2)))) ; to show user the message! + ;; Should execute `ls-lisp-version-lessp' + ;; after sorting by `ls-lisp-string-lessp' or others + ;; + ;; The reason: + ;; See the following numbers. + ;; "1.5" + ;; "1.05" + ;; + ;; `ls-lisp-string-lessp' *may* eval that both numbers are equal. + ;; So the function returns `nil'. In other words, the order is unchanged. + ;; But it is clear that these numbers shoud be sorted + ;; in lexicographic order before. + (if (and (not (memq ?U switches)) ; unsorted + (memq ?v switches)) + ;; Catch and ignore unexpected sorting errors + (condition-case err + (setq file-alist + (let (index) + ;; Copy file-alist in case of error + (sort (copy-sequence file-alist) ; modifies its argument! + (lambda (x y) ; sorted on version + (ls-lisp-version-lessp (car x) (car y) + ls-lisp-ignore-case))))) + (error (message "Unsorted (ls-lisp sorting error) - %s" + (error-message-string err)) + (ding) (sit-for 2)))) ; to show user the message! (if (memq ?F switches) ; classify switch (setq file-alist (mapcar 'ls-lisp-classify file-alist))) (if ls-lisp-dirs-first