From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jari Aalto Newsgroups: gmane.emacs.bugs Subject: Re: [PATCH] Emacs CVS: find-file.el - Line up all columns in output Date: Tue, 09 Oct 2007 11:51:39 +0300 Organization: Private Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1191919661 14670 80.91.229.12 (9 Oct 2007 08:47:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Oct 2007 08:47:41 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: rms@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 09 10:47:40 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IfAkV-0008RE-2A for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Oct 2007 10:47:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfAkP-0001Lv-Ly for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Oct 2007 04:47:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IfAkN-0001KS-0M for bug-gnu-emacs@gnu.org; Tue, 09 Oct 2007 04:47:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IfAkI-0001FX-D6 for bug-gnu-emacs@gnu.org; Tue, 09 Oct 2007 04:47:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfAkI-0001FI-0V for bug-gnu-emacs@gnu.org; Tue, 09 Oct 2007 04:47:18 -0400 Original-Received: from emh06.mail.saunalahti.fi ([62.142.5.116]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IfAkC-0003Q8-Nv; Tue, 09 Oct 2007 04:47:13 -0400 Original-Received: from saunalahti-vams (vs3-12.mail.saunalahti.fi [62.142.5.96]) by emh06-2.mail.saunalahti.fi (Postfix) with SMTP id 2C6E1C8C0C; Tue, 9 Oct 2007 11:47:09 +0300 (EEST) Original-Received: from emh07.mail.saunalahti.fi ([62.142.5.117]) by vs3-12.mail.saunalahti.fi ([62.142.5.96]) with SMTP (gateway) id A05A000464C; Tue, 09 Oct 2007 11:47:09 +0300 Original-Received: from cante.net (a81-197-175-198.elisa-laajakaista.fi [81.197.175.198]) by emh07.mail.saunalahti.fi (Postfix) with ESMTP id E7B911C6580; Tue, 9 Oct 2007 11:47:06 +0300 (EEST) In-Reply-To: (Richard Stallman's message of "Mon, 08 Oct 2007 21:14:43 -0400") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (windows-nt) X-Antivirus: VAMS X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16710 Archived-At: * Mon 2007-10-08 Richard Stallman INBOX > I don't think this change fully does the job, because file sizes > can be more than 6 digits. I increased the size to 10 digits, which accomodates up to 9G. The format is now also user configurable. Jari etc/ChangeLog 2007-10-09 Jari Aalto * NEWS: Document new variable `find-dired-file-size-format' diff --git a/NEWS b/NEWS index b2e185b..3951639 100644 --- a/NEWS +++ b/NEWS @@ -238,6 +238,9 @@ saving changes. *** The new command `eshell/info' runs info in an eshell buffer. +*** The new variable `find-dired-file-size-format' controls the placement +of file sizes in command `find-dired'. + * Changes in Emacs 23.1 on non-free operating systems lisp/Changelog 2007-10-08 Jari Aalto * find-dired.el (find-dired-filter): Make output line up by adjusting the position of file sizes at column 5. (find-dired-file-size-format): New customizable variable. diff --git a/find-dired.el b/find-dired.el index 0a3de85..0c0c031 100644 --- a/find-dired.el +++ b/find-dired.el @@ -77,6 +77,9 @@ On other systems, the closest you can come is to use `-l'." :type 'string :group 'find-dired) +(defcustom find-dired-file-size-format "%10s" ;; Up to 1-9G file size + "*Format spec of `find-dired' listing for file sizes.") + (defvar find-args nil "Last arguments given to `find' by \\[find-dired].") @@ -232,7 +235,12 @@ Thus ARG can also contain additional grep options." (defun find-dired-filter (proc string) ;; Filter for \\[find-dired] processes. (let ((buf (process-buffer proc)) - (inhibit-read-only t)) + (inhibit-read-only t) + (l-opt (and (consp find-ls-option) + (string-match "l" (cdr find-ls-option)))) + (size-regexp (concat + "^ *[^ \t\r\n]+ +[^ \t\r\n]+ +" + "[^ \t\r\n]+ +[^ \t\r\n]+ +\\([0-9]+\\)"))) (if (buffer-name buf) ; not killed? (save-excursion (set-buffer buf) @@ -255,6 +263,20 @@ Thus ARG can also contain additional grep options." (goto-char (- end 3)) ; no error if < 0 (while (search-forward " ./" nil t) (delete-region (point) (- (point) 2))) + ;; Make output line up by adjusting the file size at column 5 + ;; -rw-r----x 1 foo foo 2425 Dec 5 2005 file.txt + ;; -rw-r----x 1 foo foo 25 Dec 5 2005 test.tmp + (if l-opt + (progn + (goto-char (- end 3)) + (if (re-search-forward size-regexp nil t) + (replace-match + (format find-dired-file-size-format + (match-string 1)) + (not 'fixcase) + (not 'literal) + (not 'string) + 1)))) ;; Find all the complete lines in the unprocessed ;; output and process it to add text properties. (goto-char (point-max))