[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/disk-usage dcfbd19 29/48: Rename sort functions
From: |
Stefan Monnier |
Subject: |
[elpa] externals/disk-usage dcfbd19 29/48: Rename sort functions |
Date: |
Tue, 19 Feb 2019 08:00:02 -0500 (EST) |
branch: externals/disk-usage
commit dcfbd19c79a252f74cec734ef9e8ea3a87a01f32
Author: Pierre Neidhardt <address@hidden>
Commit: Pierre Neidhardt <address@hidden>
Rename sort functions
---
disk-usage.el | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/disk-usage.el b/disk-usage.el
index 9f8eedd..116dca0 100644
--- a/disk-usage.el
+++ b/disk-usage.el
@@ -194,10 +194,9 @@ This is slow but does not require any external process."
disk-usage--du-args path))
(buffer-string))))))
-(defun disk-usage--sort-size-< (a b)
- (let ((size-a (string-to-number (aref (cadr a) 0)))
- (size-b (string-to-number (aref (cadr b) 0))))
- (< size-a size-b)))
+(defun disk-usage--sort-by-size (a b)
+ (< (disk-usage--file-info-size (car a))
+ (disk-usage--file-info-size (car b))))
(defcustom disk-usage-size-format-function #'file-size-human-readable
"How to print size.
@@ -206,15 +205,13 @@ Takes a number and returns a string."
:type '(choice (function :tag "Human readable" file-size-human-readable)
(function :tag "In bytes" number-to-string)))
-(defvar disk-usage--sort #'disk-usage--sort-size-<)
-
(defun disk-usage--set-tabulated-list-format (&optional total-size)
(setq tabulated-list-format
`[("Size"
,(if (eq disk-usage-size-format-function #'file-size-human-readable)
8
12)
- ,disk-usage--sort . (:right-align t))
+ disk-usage--sort-by-size . (:right-align t))
(,(format "Files %sin '%s'"
(if total-size
(format "totalling %sB (%s) "
@@ -429,24 +426,24 @@ TYPE is the file extension (lower case)."
(/ (float (disk-usage--type-info-size type))
(disk-usage--type-info-count type)))
-(defun disk-usage--sort-by-count (a b)
+(defun disk-usage-by-types--sort-by-count (a b)
(< (disk-usage--type-info-count (car a))
(disk-usage--type-info-count (car b))))
-(defun disk-usage--sort-by-size (a b)
+(defun disk-usage-by-types--sort-by-size (a b)
(< (disk-usage--type-info-size (car a))
(disk-usage--type-info-size (car b))))
-(defun disk-usage--sort-by-average (a b)
+(defun disk-usage-by-types--sort-by-average (a b)
(< (disk-usage--type-average-size (car a))
(disk-usage--type-average-size (car b))))
(defun disk-usage-by-types--set-tabulated-list-format ()
(setq tabulated-list-format
`[("Extension" 12 t)
- ("Count" 12 disk-usage--sort-by-count)
- ("Total size" 12 disk-usage--sort-by-size)
- ("Average size" 15 disk-usage--sort-by-average)]))
+ ("Count" 12 disk-usage-by-types--sort-by-count)
+ ("Total size" 12 disk-usage-by-types--sort-by-size)
+ ("Average size" 15 disk-usage-by-types--sort-by-average)]))
(defun disk-usage-by-types--refresh (&optional directory)
(setq directory (or directory default-directory))
- [elpa] externals/disk-usage f3bcae9 22/48: readme: Link to Guix, (continued)
- [elpa] externals/disk-usage f3bcae9 22/48: readme: Link to Guix, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage f330f01 31/48: Fix structure manipulation in disk-usage-by-types, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 00aa40a 10/48: Bind "S-<return>" to disk-usage-find-file-at-point, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 4fc5cb3 33/48: Refresh cache with prefix argument, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 1949c82 37/48: Add disk-usage-by-types-here, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage f3895a3 27/48: Normalize some function names, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 0d4ce4b 12/48: Bind "^" and "<backspace>" to disk-usage-up, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage aa3996e 24/48: Default to disk-usage--list, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 90607dc 23/48: Use file-info structure instead of vectors, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage ed9dc23 11/48: Keep cursor on current entry when re-ordering buffer, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage dcfbd19 29/48: Rename sort functions,
Stefan Monnier <=
- [elpa] externals/disk-usage 0c135ed 21/48: Handle inaccessible directories, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 19103ba 42/48: Add unmark-at-point, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 3357ba9 32/48: Include screenshots, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 2626642 15/48: Remove spurious "evil" keyword, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage eefa57f 28/48: Turn disk-usage-size-format-function into a defcustom, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage af22dd4 13/48: Display symlinks when not displaying full paths, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 3ffaf8e 14/48: Fix header display, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 7fe5f1b 40/48: Fix keymap setup in disk-usage-by-types-mode, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage d959b7b 36/48: Display % column and sort types by total size, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 3bbb09a 44/48: Right-align columns with units, Stefan Monnier, 2019/02/19