emacs-devel
[Top][All Lists]
Advanced

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

patch for Dired second header line info


From: Drew Adams
Subject: patch for Dired second header line info
Date: Fri, 29 Feb 2008 17:03:52 -0800

The second header line in a Dired buffer currently looks like this:

 total used in directory 49439 available 56233408

Attached is a patch (for `files.el' and `ls-lisp.el') that changes that text
to this:

 files 691 space used 49439 available 56233408

IOW, it adds the number of files and directories (`files'), and it shortens
`total used in directory' to `space used'. That also makes it clearer what
"total used" means (total what?). We might want to change `space used' to
`Kbytes used' or whatever, to be even clearer.

Entries `.' and `..' are not counted, but other directories are, along with
non-directory files. The patch works for `-lR' listings also, updating the
subdir totals.

Room for improvement: 

1. Like the current code, this code replaces the initial text `total' that
is written to the buffer. Perhaps we could just write the correct text to
begin with, instead of doing a text substitution for the placeholder
`total'?

2. The proposed code does this:
(add-hook 'dired-after-readin-hook
          'update-dired-files-count)

Perhaps we could do the `update-dired-files-count' directly in the code that
runs the hook, instead?

As it stands now, the file count and the space counts are updated only
during directory read-in - e.g. when you hit `g' (nothing new in that, BTW).
I could not find a hook for when a file or dir is added/deleted (or
hidden/shown), etc. Wouldn't it be useful to have a hook for whenever the
Dired display changes? 


Here's a change-log entry:

2008-02-29 Drew Adams  <address@hidden>
        * files.el:
        (insert-directory): Print number of files.
        (count-dired-files): New function.
        (update-dired-files-count): New function.
        * ls-lisp.el (insert-directory): Print number of files.

Attachment: ls-lisp-2008-02-29.patch
Description: Binary data

Attachment: files-2008-02-29.patch
Description: Binary data


reply via email to

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