GNU bug report logs - #29803
[PATCH] Fix output alignment in find-dired

Previous Next

Package: emacs;

Reported by: Sebastian Reuße <seb <at> wirrsal.net>

Date: Thu, 21 Dec 2017 16:30:02 UTC

Severity: minor

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29803 in the body.
You can then email your comments to 29803 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Thu, 21 Dec 2017 16:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sebastian Reuße <seb <at> wirrsal.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Dec 2017 16:30:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Reuße <seb <at> wirrsal.net>
To: bug-gnu-emacs <at> gnu.org
Cc: Sebastian Reuße <seb <at> wirrsal.net>
Subject: [PATCH] Fix output alignment in find-dired
Date: Thu, 21 Dec 2017 10:08:17 +0100
* 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Thu, 21 Dec 2017 18:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 29803 <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Reuße <seb <at> wirrsal.net>
To: 29803 <at> debbugs.gnu.org
Cc: Sebastian Reuße <seb <at> wirrsal.net>
Subject: [PATCH] Fix output alignment in find-dired
Date: Thu, 21 Dec 2017 19:08:11 +0100
* 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Thu, 21 Dec 2017 18:13:01 GMT) Full text and rfc822 format available.

Message #11 received at 29803 <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Reuße <seb <at> wirrsal.net>
To: 29803 <at> debbugs.gnu.org
Cc: Sebastian Reuße <seb <at> wirrsal.net>
Subject: Re: [PATCH] Fix output alignment in find-dired
Date: Thu, 21 Dec 2017 19:12:35 +0100
Sebastian Reuße <seb <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Fri, 22 Dec 2017 14:48:02 GMT) Full text and rfc822 format available.

Message #14 received at 29803 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastian Reuße <seb <at> wirrsal.net>
Cc: 29803 <at> debbugs.gnu.org, seb <at> wirrsal.net
Subject: Re: bug#29803: [PATCH] Fix output alignment in find-dired
Date: Fri, 22 Dec 2017 16:46:49 +0200
> From: Sebastian Reuße <seb <at> wirrsal.net>
> Date: Thu, 21 Dec 2017 19:08:11 +0100
> Cc: Sebastian Reuße <seb <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Fri, 22 Dec 2017 15:25:02 GMT) Full text and rfc822 format available.

Message #17 received at 29803 <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Reuße <seb <at> wirrsal.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29803 <at> debbugs.gnu.org
Subject: Re: bug#29803: [PATCH] Fix output alignment in find-dired
Date: Fri, 22 Dec 2017 16:24:13 +0100
Hello Eli,

Eli Zaretskii <eliz <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29803; Package emacs. (Fri, 22 Dec 2017 15:25:02 GMT) Full text and rfc822 format available.

Message #20 received at 29803 <at> debbugs.gnu.org (full text, mbox):

From: Sebastian Reuße <seb <at> wirrsal.net>
To: 29803 <at> debbugs.gnu.org
Cc: Sebastian Reuße <seb <at> wirrsal.net>
Subject: [PATCH] Fix output alignment in find-dired
Date: Fri, 22 Dec 2017 16:24:24 +0100
* 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





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 30 Dec 2017 10:45:02 GMT) Full text and rfc822 format available.

Notification sent to Sebastian Reuße <seb <at> wirrsal.net>:
bug acknowledged by developer. (Sat, 30 Dec 2017 10:45:02 GMT) Full text and rfc822 format available.

Message #25 received at 29803-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastian Reuße <seb <at> wirrsal.net>
Cc: 29803-done <at> debbugs.gnu.org
Subject: Re: bug#29803: [PATCH] Fix output alignment in find-dired
Date: Sat, 30 Dec 2017 12:44:10 +0200
> From: Sebastian Reuße <seb <at> wirrsal.net>
> Date: Fri, 22 Dec 2017 16:24:24 +0100
> Cc: Sebastian Reuße <seb <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 27 Jan 2018 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.