unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29803: [PATCH] Fix output alignment in find-dired
@ 2017-12-21  9:08 Sebastian Reuße
  2017-12-21 18:08 ` Sebastian Reuße
  2017-12-22 15:24 ` Sebastian Reuße
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Reuße @ 2017-12-21  9:08 UTC (permalink / raw)
  To: 29803; +Cc: Sebastian Reuße

* lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
column when the user is using human file sizes as per ‘find-ls-option’.
---
 lisp/find-dired.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 3b0613b280..4501da991b 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -295,7 +295,7 @@ specifies what to use in place of \"-ls\" as the final argument."
 		    (l-opt (and (consp find-ls-option)
 				(string-match "l" (cdr find-ls-option))))
 		    (ls-regexp (concat "^ +[^ \t\r\n]+\\( +[^ \t\r\n]+\\) +"
-				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+\\)")))
+				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+[kMGT]?\\)")))
 		(goto-char beg)
 		(insert string)
 		(goto-char beg)
-- 
2.15.1






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-21  9:08 bug#29803: [PATCH] Fix output alignment in find-dired Sebastian Reuße
@ 2017-12-21 18:08 ` Sebastian Reuße
  2017-12-21 18:12   ` Sebastian Reuße
  2017-12-22 14:46   ` Eli Zaretskii
  2017-12-22 15:24 ` Sebastian Reuße
  1 sibling, 2 replies; 7+ messages in thread
From: Sebastian Reuße @ 2017-12-21 18:08 UTC (permalink / raw)
  To: 29803; +Cc: Sebastian Reuße

* lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
column when the user is using human file sizes as per ‘find-ls-option’.
---
 lisp/find-dired.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 3b0613b280..0179860a60 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -295,7 +295,7 @@ specifies what to use in place of \"-ls\" as the final argument."
 		    (l-opt (and (consp find-ls-option)
 				(string-match "l" (cdr find-ls-option))))
 		    (ls-regexp (concat "^ +[^ \t\r\n]+\\( +[^ \t\r\n]+\\) +"
-				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+\\)")))
+				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9.,]+[kMGT]?\\)")))
 		(goto-char beg)
 		(insert string)
 		(goto-char beg)
-- 
2.15.1






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-21 18:08 ` Sebastian Reuße
@ 2017-12-21 18:12   ` Sebastian Reuße
  2017-12-22 14:46   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Sebastian Reuße @ 2017-12-21 18:12 UTC (permalink / raw)
  To: 29803; +Cc: Sebastian Reuße


Sebastian Reuße <seb@wirrsal.net> writes:

> * lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
> column when the user is using human file sizes as per ‘find-ls-option’.

Sorry, forgot to amend an additional change from my working directory
before mailing the patch. This supersedes the original patch.

Kind regards,
SR





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-21 18:08 ` Sebastian Reuße
  2017-12-21 18:12   ` Sebastian Reuße
@ 2017-12-22 14:46   ` Eli Zaretskii
  2017-12-22 15:24     ` Sebastian Reuße
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-12-22 14:46 UTC (permalink / raw)
  To: Sebastian Reuße; +Cc: 29803, seb

> From: Sebastian Reuße <seb@wirrsal.net>
> Date: Thu, 21 Dec 2017 19:08:11 +0100
> Cc: Sebastian Reuße <seb@wirrsal.net>
> 
> * lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
> column when the user is using human file sizes as per ‘find-ls-option’.

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-22 14:46   ` Eli Zaretskii
@ 2017-12-22 15:24     ` Sebastian Reuße
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Reuße @ 2017-12-22 15:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29803

Hello Eli,

Eli Zaretskii <eliz@gnu.org> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-21  9:08 bug#29803: [PATCH] Fix output alignment in find-dired Sebastian Reuße
  2017-12-21 18:08 ` Sebastian Reuße
@ 2017-12-22 15:24 ` Sebastian Reuße
  2017-12-30 10:44   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Reuße @ 2017-12-22 15:24 UTC (permalink / raw)
  To: 29803; +Cc: Sebastian Reuße

* lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
column when the user is using human file sizes as per ‘find-ls-option’.
---
 lisp/find-dired.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 3b0613b280..bf815d500d 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -295,7 +295,7 @@ specifies what to use in place of \"-ls\" as the final argument."
 		    (l-opt (and (consp find-ls-option)
 				(string-match "l" (cdr find-ls-option))))
 		    (ls-regexp (concat "^ +[^ \t\r\n]+\\( +[^ \t\r\n]+\\) +"
-				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+\\)")))
+				       "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[^[:space:]]+\\)")))
 		(goto-char beg)
 		(insert string)
 		(goto-char beg)
-- 
2.15.1






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#29803: [PATCH] Fix output alignment in find-dired
  2017-12-22 15:24 ` Sebastian Reuße
@ 2017-12-30 10:44   ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2017-12-30 10:44 UTC (permalink / raw)
  To: Sebastian Reuße; +Cc: 29803-done

> From: Sebastian Reuße <seb@wirrsal.net>
> Date: Fri, 22 Dec 2017 16:24:24 +0100
> Cc: Sebastian Reuße <seb@wirrsal.net>
> 
> * lisp/find-dired.el (find-dired-filter): Fix alignment of the file size
> column when the user is using human file sizes as per ‘find-ls-option’.

Thanks, pushed to the master branch.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-30 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21  9:08 bug#29803: [PATCH] Fix output alignment in find-dired Sebastian Reuße
2017-12-21 18:08 ` Sebastian Reuße
2017-12-21 18:12   ` Sebastian Reuße
2017-12-22 14:46   ` Eli Zaretskii
2017-12-22 15:24     ` Sebastian Reuße
2017-12-22 15:24 ` Sebastian Reuße
2017-12-30 10:44   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).