Subject: bug#29803: [PATCH] Fix output alignment in find-dired

From: Sebastian Reuße <[email-masked]>
Date: Fri, 22 Dec 2017 16:24:13 +0100

Hello Eli,

Eli Zaretskii <[email-masked]> writes:

> Thanks.  Could you please provide a minimum example to demonstrate the
> current code's mis-alignment and how your patch fixes that?

You can reproduce the alignment issue when using the example from the
`find-ls-option` docs:

    (let ((find-ls-option '("-exec ls -ldh {} +" . "-ldh")))
      (find-dired "/tmp" "-type f"))

E.g., for me, this yields:

  -rw-------   1 seb users      226K 22. Dez 14:59 emacs-trustFuURayKH
  -rw-------   1 seb users      226K 22. Dez 14:59 emacs-trustI8LaIFbp
  -rw-------   1 seb users      156 22. Dez 14:58 serverauth.Zq2gEantga
  -r--r--r--   1 seb users       11 22. Dez 14:58 .X0-lock

find-dired uses a regex group to align the size column. This group
currently does not include the size suffix, so when using
human-formatted output, the remaining columns are misaligned.

When we include the suffix in the capture group, we get the desired
alignment:

  -rw-------   1 seb users      226K 22. Dez 14:59 emacs-trustFuURayKH
  -rw-------   1 seb users      226K 22. Dez 14:59 emacs-trustI8LaIFbp
  -rw-------   1 seb users       156 22. Dez 14:58 serverauth.Zq2gEantga
  -r--r--r--   1 seb users        11 22. Dez 14:58 .X0-lock

Actually, it now occurs to me that the suffix might vary in case, e.g.
when using ‘--si’ output. I’d propose we instead have the group capture
all consecutive non-whitespace (cf. superseding patch). This would then
also cover the decimal and thousands separators.

Kind regards,
SR

--
Insane cobra split the wood
Trader of the lowland breed
Call a jittney, drive away
In the slipstream we will stay