[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/disk-usage af22dd4 13/48: Display symlinks when not dis
From: |
Stefan Monnier |
Subject: |
[elpa] externals/disk-usage af22dd4 13/48: Display symlinks when not displaying full paths |
Date: |
Tue, 19 Feb 2019 07:59:59 -0500 (EST) |
branch: externals/disk-usage
commit af22dd4db62c6dff580d4d42016d5d0c84cccd0a
Author: Pierre Neidhardt <address@hidden>
Commit: Pierre Neidhardt <address@hidden>
Display symlinks when not displaying full paths
---
disk-usage.el | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/disk-usage.el b/disk-usage.el
index 230b38f..b2d1ee3 100644
--- a/disk-usage.el
+++ b/disk-usage.el
@@ -99,11 +99,7 @@
;; Symlinks
if (stringp (file-attribute-type attributes))
collect (vector (file-attribute-size attributes)
- (concat (propertize path
- 'face (if
(file-directory-p path)
-
'disk-usage-symlink-directory
-
'disk-usage-symlink))
- " -> " (file-attribute-type
attributes)))
+ path)
;; Folders
else if (and (eq t (file-attribute-type attributes))
(not (string= "." (file-name-base path)))
@@ -169,6 +165,7 @@ This is slow but does not require any external process."
(mapcar (lambda (e)
(list e (vector (number-to-string (aref e 0))
(if (file-directory-p (aref e 1))
+ ;; Make button.
(cons (aref e 1)
(list 'action
(lambda (_)
@@ -181,7 +178,6 @@ This is slow but does not require any external process."
(size-b (string-to-number (aref (cadr b) 0))))
(< size-a size-b)))
-;; TODO: Customize sort options.
(defvar disk-usage--sort #'disk-usage--sort-size-<)
(defvar disk-usage--format-size #'file-size-human-readable
@@ -213,11 +209,20 @@ Takes a string and returns a string.
(defun disk-usage--print-file-col (file-entry)
"Call `disk-usage--format-file' on FILE-ENTRY.
FILE-ENTRY may be a string or a button."
- (if (listp file-entry)
- (let ((copy (cl-copy-list file-entry)))
- (setcar copy (funcall disk-usage--format-files (car copy)))
- copy)
- (funcall disk-usage--format-files file-entry)))
+ (let* ((filename (if (listp file-entry)
+ (cl-first file-entry)
+ file-entry))
+ (formatted-filename (if (stringp (file-attribute-type
(file-attributes filename)))
+ (propertize (funcall disk-usage--format-files
filename)
+ 'face (if (file-directory-p
filename)
+
'disk-usage-symlink-directory
+ 'disk-usage-symlink))
+ (funcall disk-usage--format-files filename))))
+ (if (listp file-entry)
+ (let ((copy (cl-copy-list file-entry)))
+ (setcar copy formatted-filename)
+ copy)
+ formatted-filename)))
(defun disk-usage--print-entry (id cols)
"Like `tabulated-list-print-entry' but formats size for human
@@ -251,7 +256,7 @@ beings."
(define-derived-mode disk-usage-mode tabulated-list-mode "Disk Usage"
"Mode to display disk usage."
- ;; TODO: Option to display extra attributes.
+ ;; TODO: Option to display extra attributes and default column to sort.
(setq tabulated-list-sort-key (cons "Size" 'flip))
(setq tabulated-list-printer #'disk-usage--print-entry)
(add-hook 'tabulated-list-revert-hook 'disk-usage--refresh nil t)
- [elpa] externals/disk-usage 0d4ce4b 12/48: Bind "^" and "<backspace>" to disk-usage-up, (continued)
- [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, 2019/02/19
- [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 <=
- [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
- [elpa] externals/disk-usage 441abf9 20/48: Add disk-usage-by-types, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 2d6fe3c 08/48: Resolve directory statically in button action, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 5998d42 41/48: Version 1.0.0, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 21b5749 38/48: Add disk-usage-files, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage e44979a 45/48: Version 1.1.0, Stefan Monnier, 2019/02/19
- [elpa] externals/disk-usage 696dd5c2 17/48: Fix free references, Stefan Monnier, 2019/02/19