From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: patch for Dired second header line info Date: Sun, 2 Mar 2008 11:06:49 -0800 Message-ID: <003701c87c98$91cec6e0$0600a8c0@us.oracle.com> References: <000101c87b38$1dcd2db0$0600a8c0@us.oracle.com><87fxv9zxqv.fsf@jurta.org><000f01c87c3c$22f7db50$0600a8c0@us.oracle.com><87y791mess.fsf@jurta.org><002801c87c82$539474d0$0600a8c0@us.oracle.com><002901c87c8d$c299c730$0600a8c0@us.oracle.com><87zlth7zwh.fsf@jurta.org> <003001c87c97$24a81400$0600a8c0@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0038_01C87C55.83AB86E0" X-Trace: ger.gmane.org 1204484895 5053 80.91.229.12 (2 Mar 2008 19:08:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Mar 2008 19:08:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Juri Linkov'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 02 20:08:40 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JVtY7-0000UT-Gy for ged-emacs-devel@m.gmane.org; Sun, 02 Mar 2008 20:08:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JVtXa-00067v-Ki for ged-emacs-devel@m.gmane.org; Sun, 02 Mar 2008 14:08:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JVtXL-00062r-O1 for emacs-devel@gnu.org; Sun, 02 Mar 2008 14:07:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JVtXK-00061z-Cn for emacs-devel@gnu.org; Sun, 02 Mar 2008 14:07:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JVtXK-00061t-2a for emacs-devel@gnu.org; Sun, 02 Mar 2008 14:07:50 -0500 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JVtXJ-0003cb-DJ for emacs-devel@gnu.org; Sun, 02 Mar 2008 14:07:49 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m22J7kge025001; Sun, 2 Mar 2008 13:07:47 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m22J7ji0021806; Sun, 2 Mar 2008 12:07:45 -0700 Original-Received: from inet-141-146-46-1.oracle.com by acsmt350.oracle.com with ESMTP id 3596862511204484804; Sun, 02 Mar 2008 11:06:44 -0800 Original-Received: from dradamslap1 (/141.144.64.82) by bhmail.oracle.com (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 02 Mar 2008 11:06:44 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <003001c87c97$24a81400$0600a8c0@us.oracle.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Thread-Index: Ach8kyoxSjVIy1hwQAes+KBMWOXW9QAAeEEAAADRkpA= X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:91090 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C87C55.83AB86E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > Great minds think alike. I was already doing that - new patch > attached. (Also fixed a bug introduced in last patch.) Sorry, I forgot to include that bug fix in the files.el patch. Attached. ------=_NextPart_000_0038_01C87C55.83AB86E0 Content-Type: application/octet-stream; name="files-2008-03-02c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="files-2008-03-02c.patch" diff -c -w "files-CVS-2008-02-29.el" "files-patched-2008-03-02c.el"=0A= *** files-CVS-2008-02-29.el Fri Feb 29 14:59:08 2008=0A= --- files-patched-2008-03-02c.el Sun Mar 2 11:02:58 2008=0A= ***************=0A= *** 5284,5302 ****=0A= (if val=0A= (put-text-property pos (point)=0A= 'dired-filename t)))))))=0A= ! =0A= ! (if full-directory-p=0A= ! ;; Try to insert the amount of free space.=0A= (save-excursion=0A= (goto-char beg)=0A= ! ;; First find the line to put it on.=0A= ! (when (re-search-forward "^ *\\(total\\)" nil t)=0A= ! (let ((available (get-free-disk-space ".")))=0A= (when available=0A= - ;; Replace "total" with "used", to avoid confusion.=0A= - (replace-match "total used in directory" nil nil nil 1)=0A= (end-of-line)=0A= ! (insert " available " available)))))))))))=0A= =0A= (defun insert-directory-adj-pos (pos error-lines)=0A= "Convert `ls --dired' file name position value POS to a buffer = position.=0A= --- 5284,5346 ----=0A= (if val=0A= (put-text-property pos (point)=0A= 'dired-filename t)))))))=0A= ! (when full-directory-p=0A= (save-excursion=0A= (goto-char beg)=0A= ! (while (re-search-forward "^ *\\(total\\)" nil t)=0A= ! (beginning-of-line)=0A= ! (insert "files " (number-to-string (save-match-data=0A= ! = (count-dired-files)))=0A= ! "/" (number-to-string=0A= ! (- (length (directory-files = default-directory=0A= ! nil nil t)) = 2))=0A= ! " ")=0A= ! (goto-char beg)=0A= ! (re-search-forward "^files [0-9]+/[0-9]+ \\(total\\)" = nil t)=0A= ! (replace-match "space used" nil nil nil 1)=0A= ! (let ((available (and (fboundp 'get-free-disk-space)=0A= ! (get-free-disk-space "."))))=0A= (when available=0A= (end-of-line)=0A= ! (insert " available " available)))=0A= ! (put-text-property (progn (beginning-of-line) (point))=0A= ! (progn (end-of-line) (point))=0A= ! 'help-echo "Files shown, total = files in \=0A= ! dir, Kbytes used in dir, Kbytes available on disk")))))))))=0A= ! =0A= ! (defun count-dired-files ()=0A= ! "Returns the number of files in the current Dired directory listing.=0A= ! This includes directory entries, as well as files, but it excludes `.'=0A= ! and `..'."=0A= ! ;; Should we skip `#' files also, as in `dired-trivial-filenames'? = Dunno.=0A= ! (save-excursion=0A= ! (re-search-backward "^$" nil 'to-bob)=0A= ! (re-search-forward dired-move-to-filename-regexp nil t)=0A= ! (let* ((beg (line-beginning-position))=0A= ! (end (save-excursion (re-search-forward "^$" nil t)))=0A= ! (dots-p (save-excursion ; Is `..' present?=0A= ! (goto-char beg)=0A= ! (re-search-forward=0A= ! (concat directory-listing-before-filename-regexp=0A= ! "\\.\\./?$")=0A= ! end t))))=0A= ! (if dots-p (- (count-lines beg end) 2) (count-lines beg end)))))=0A= ! =0A= ! (add-hook 'dired-after-readin-hook 'update-dired-files-count)=0A= ! (defun update-dired-files-count ()=0A= ! "Update file count in Dired header for each directory listed."=0A= ! (let ((num-files (number-to-string (count-dired-files))))=0A= ! (save-excursion=0A= ! (goto-char (point-min))=0A= ! (while (re-search-forward "^ files \\([0-9]+\\)/\\([0-9]+\\)" = nil t)=0A= ! (let ((buffer-read-only nil))=0A= ! (replace-match (number-to-string (save-match-data = (count-dired-files)))=0A= ! nil nil nil 1)=0A= ! (replace-match (number-to-string=0A= ! (- (length (directory-files default-directory=0A= ! nil nil t)) 2))=0A= ! nil nil nil 2))=0A= ! (set-buffer-modified-p nil)))))=0A= =0A= (defun insert-directory-adj-pos (pos error-lines)=0A= "Convert `ls --dired' file name position value POS to a buffer = position.=0A= =0A= Diff finished at Sun Mar 02 11:03:47=0A= ------=_NextPart_000_0038_01C87C55.83AB86E0 Content-Type: application/octet-stream; name="ls-lisp-2008-03-02b.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ls-lisp-2008-03-02b.patch" diff -c -w ls-lisp-CVS-2008-02-29.el ls-lisp-patched-2008-03-02b.el=0A= *** ls-lisp-CVS-2008-02-29.el Fri Feb 29 14:58:50 2008=0A= --- ls-lisp-patched-2008-03-02b.el Sun Mar 2 10:51:18 2008=0A= ***************=0A= *** 260,276 ****=0A= file switches (ls-lisp-time-index switches)=0A= nil full-directory-p))=0A= (signal (car err) (cdr err)))))=0A= - ;; Try to insert the amount of free space.=0A= (save-excursion=0A= (goto-char (point-min))=0A= ! ;; First find the line to put it on.=0A= ! (when (re-search-forward "^total" nil t)=0A= ! (let ((available (get-free-disk-space ".")))=0A= (when available=0A= - ;; Replace "total" with "total used", to avoid confusion.=0A= - (replace-match "total used in directory")=0A= (end-of-line)=0A= ! (insert " available " available)))))))))=0A= =0A= (defun ls-lisp-insert-directory=0A= (file switches time-index wildcard-regexp full-directory-p)=0A= --- 260,287 ----=0A= file switches (ls-lisp-time-index switches)=0A= nil full-directory-p))=0A= (signal (car err) (cdr err)))))=0A= (save-excursion=0A= (goto-char (point-min))=0A= ! (while (re-search-forward "^total" nil t)=0A= ! (beginning-of-line)=0A= ! (insert "files " (number-to-string (save-match-data=0A= ! (count-dired-files)))=0A= ! "/" (number-to-string=0A= ! (- (length (directory-files default-directory=0A= ! nil nil t)) 2))=0A= ! " ")=0A= ! (goto-char (point-min))=0A= ! (re-search-forward "^files [0-9]+/[0-9]+ \\(total\\)" nil = t)=0A= ! (replace-match "space used" nil nil nil 1)=0A= ! (let ((available (and (fboundp 'get-free-disk-space)=0A= ! (get-free-disk-space "."))))=0A= (when available=0A= (end-of-line)=0A= ! (insert " available " available)))=0A= ! (put-text-property (progn (beginning-of-line) (point))=0A= ! (progn (end-of-line) (point))=0A= ! 'help-echo "Files shown, total files in = \=0A= ! dir, Kbytes used in dir, Kbytes available on disk")))))))=0A= =0A= (defun ls-lisp-insert-directory=0A= (file switches time-index wildcard-regexp full-directory-p)=0A= =0A= Diff finished. Sun Mar 02 10:51:42 2008=0A= ------=_NextPart_000_0038_01C87C55.83AB86E0--