all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: [ELPA] New package: disk-usage
Date: Tue, 26 Feb 2019 12:59:53 +0100	[thread overview]
Message-ID: <87ftsarc92.fsf@gmx.de> (raw)
In-Reply-To: <87bm31nm5w.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Sun, 24 Feb 2019 18:14:51 +0100")

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Pierre Neidhardt <mail@ambrevar.xyz> writes:

Hi Pierre,

> I've released 1.2.0.

Thanks. I needed to apply the following patch to make it work on remote
systems. In my local environment, I could test it on "/sudo::"; it makes
a difference because "/root" is readable only for user "root".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2758 bytes --]

*** /home/albinus/.emacs.d/elpa/disk-usage-1.2.0/disk-usage.el.~1~	2019-02-26 11:50:08.976859553 +0100
--- /home/albinus/.emacs.d/elpa/disk-usage-1.2.0/disk-usage.el	2019-02-26 12:21:11.661869542 +0100
***************
*** 290,298 ****
    "This is the equivalent of running the shell command
  $ find . -type f -exec du -sb {} +"
    (setq directory (or directory default-directory))
!   (let ((pair-strings (split-string (with-temp-buffer
                             (process-file disk-usage--find-command nil '(t nil) nil
!                                          directory
                                           "-type" "f"
                                           "-exec"
                                           disk-usage--du-command
--- 290,299 ----
    "This is the equivalent of running the shell command
  $ find . -type f -exec du -sb {} +"
    (setq directory (or directory default-directory))
!   (let* ((default-directory directory)
! 	 (pair-strings (split-string (with-temp-buffer
                             (process-file disk-usage--find-command nil '(t nil) nil
!                                          (file-local-name directory)
                                           "-type" "f"
                                           "-exec"
                                           disk-usage--du-command
***************
*** 301,307 ****
                                      "\n" 'omit-nulls)))
      (cl-loop for pair-string in pair-strings
               for pair = (split-string pair-string "\t")
!              for name = (cadr pair)
               for attributes = (file-attributes name)
               when (cl-loop for filter in disk-usage-filters
                             always (funcall filter name attributes))
--- 302,308 ----
                                      "\n" 'omit-nulls)))
      (cl-loop for pair-string in pair-strings
               for pair = (split-string pair-string "\t")
!              for name = (concat (file-remote-p directory) (cadr pair))
               for attributes = (file-attributes name)
               when (cl-loop for filter in disk-usage-filters
                             always (funcall filter name attributes))
***************
*** 351,357 ****
         (with-output-to-string
           (process-file disk-usage--du-command
                         nil '(t nil) nil
!                        disk-usage--du-args path))
         (buffer-string))))))
  
  (defun disk-usage--sort-by-size (a b)
--- 352,358 ----
         (with-output-to-string
           (process-file disk-usage--du-command
                         nil '(t nil) nil
!                        disk-usage--du-args (file-local-name path)))
         (buffer-string))))))
  
  (defun disk-usage--sort-by-size (a b)

[-- Attachment #3: Type: text/plain, Size: 794 bytes --]


There are further things to be improved:

* In `disk-usage--list-recursively', you make a loop over

             for attributes = (file-attributes name)

  This is slow, at least on remote systems, because you apply
  `file-attributes' on every file on a possibly large list. Maybe you
  could call `directory-files-and-attributes' per directory, instead.
  
* As said before, the commands you apply might vary on different
  hosts. For example, on my QNAP NAS server, getting du info on "/tmp"
  with "find /tmp -type f -exec du -sb \{\} \+" does not work. It must
  be "find /tmp -type f | xargs du -sb" instead. So the commands must be
  configurable per host. See for example, how `grep-host-defaults-alist'
  is computed via `grep-compute-defaults' in grep.el.
  
Best regards, Michael.

  parent reply	other threads:[~2019-02-26 11:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  8:49 [ELPA] New package: disk-usage Pierre Neidhardt
2019-02-19 15:55 ` Clément Pit-Claudel
2019-02-19 16:17 ` Eli Zaretskii
2019-02-19 16:26   ` Pierre Neidhardt
2019-02-19 17:25     ` Eli Zaretskii
2019-02-19 19:29       ` Pierre Neidhardt
2019-02-19 19:44         ` Eli Zaretskii
2019-02-19 19:55           ` Pierre Neidhardt
2019-02-19 20:21 ` Michael Albinus
2019-02-19 20:26   ` Pierre Neidhardt
2019-02-19 20:39     ` Michael Albinus
2019-02-19 20:58       ` describe-mode bindings (was: [ELPA] New package: disk-usage) Stefan Monnier
2019-02-19 21:29         ` Clément Pit-Claudel
2019-02-19 21:05       ` [ELPA] New package: disk-usage Pierre Neidhardt
2019-02-20  8:08         ` Pierre Neidhardt
2019-02-20 13:28           ` Stefan Monnier
2019-02-24 17:14           ` Pierre Neidhardt
2019-02-24 19:33             ` Pierre Neidhardt
2019-02-24 20:24               ` Stefan Monnier
2019-02-26 11:59             ` Michael Albinus [this message]
2019-02-26 15:08               ` Pierre Neidhardt
2019-02-26 15:25                 ` Michael Albinus
2019-03-01 17:51                   ` Pierre Neidhardt
2019-03-01 23:28                     ` Michael Albinus
2019-03-02 13:51                       ` Pierre Neidhardt
2019-03-03 10:28                     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftsarc92.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=mail@ambrevar.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.