emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ELPA] New package: dired-du


From: Tino Calancha
Subject: Re: [ELPA] New package: dired-du
Date: Sat, 27 May 2017 19:06:21 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Sat, 27 May 2017, Yuri Khan wrote:

On Fri, May 26, 2017 at 8:02 PM, Tino Calancha <address@hidden> wrote:

New library implementing a Dired interface for `du'.

That sounds great.

I)
This library defines a minor mode `dired-du-mode' to display
the recursive size of directories in Dired buffers.  This mode
uses the external `du' program when available.  Otherwise, it
performs a rough estimation with Lisp.

Would it be useful to extract the Lisp replacement of du as a separate
library, or does that raise too many questions about cache management?
That part is expected to be very slow. I just added recently as a fallback, but it is not the recomended way. Actually I show one warning encouraging the user to install `du'.

II)
In addition, this file provides a command `dired-du-count-sizes',
to show the total size of the marked files.  By default, it shows
the size of the files marked with `dired-marker-char'.   If `dired-du-mode'
is disabled, then ignores the size of directories.  Otherwise, it takes
in account the size of the dirs.
When called with a prefix prompts for the marks and asks if the dirs must
be taken in account.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The file is available for inspection in the following Elpa repo. branch:
scratch/dired-du

You are caching directory information in a buffer-local variable
‘dired-du-dir-info’. A single Dired buffer can show multiple
directories, and it can be killed and re-opened. Wouldn’t it make
sense to share the cache across all Dired buffers and persist it
independently of buffer lifetimes?
I don't know. I decided the implementation according with my use case: i just wanted to see the actual size of my dirs in human readable units. For this naive purpose the buffer locallity of `dired-du-dir-info' is fine.
Once other people start using the lib we might find convenient to change
those particular aspects of the implementation.

From experience with other file managers implementing directory size
calculation, it is useful to have a command that recalculates the
sizes of marked subdirectories, or the subdirectory at point, if none
are marked. (Their cached size should be discarded and replaced with
the newly calculated one.)
Good idea.  I just added the command `dired-du-update-dir-info' for
that operation.
Thank you.

Also, you are defining many functions that are copies of dired’s but
with added functionality. Would it be better to improve dired’s
functions instead?
Of course it would.
If the lib is ported to master branch, some parts of the lib will be absorbed by dired.el, dired-aux.el, dired-x.el, and the file will be
much shorter.
On the other hand, one of the nice things about Elpa is that you can support older Emacs. This file works for Emacs >= 24.4.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]