From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: dired-hide-details-mode, how to customize? Date: Thu, 25 Jun 2015 01:55:54 +0200 Message-ID: <87wpysveyd.fsf@web.de> References: <87616chohs.fsf@gmail.com> <877fqsx1w9.fsf@web.de> <87h9pwww2t.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1435190213 16619 80.91.229.3 (24 Jun 2015 23:56:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Jun 2015 23:56:53 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 25 01:56:40 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z7uX1-0005NT-QL for ged-emacs-devel@m.gmane.org; Thu, 25 Jun 2015 01:56:39 +0200 Original-Received: from localhost ([::1]:53373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7uX1-0002kb-CN for ged-emacs-devel@m.gmane.org; Wed, 24 Jun 2015 19:56:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7uWn-0002hs-Aq for emacs-devel@gnu.org; Wed, 24 Jun 2015 19:56:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7uWh-0000Em-Ga for emacs-devel@gnu.org; Wed, 24 Jun 2015 19:56:25 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:36154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7uWh-0000EW-A8 for emacs-devel@gnu.org; Wed, 24 Jun 2015 19:56:19 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z7uWb-0004yu-Bk for emacs-devel@gnu.org; Thu, 25 Jun 2015 01:56:13 +0200 Original-Received: from ip-90-186-73-162.web.vodafone.de ([90.186.73.162]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jun 2015 01:56:08 +0200 Original-Received: from michael_heerdegen by ip-90-186-73-162.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Jun 2015 01:56:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 47 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-186-73-162.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:Co2Q1PgzxaT2MG5igFzEcFR6FUg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187506 Archived-At: jenia.ivlev@gmail.com (jenia.ivlev) writes: > Should I change the function ls-lisp-insert-directory to run `wc -l` > on each file and print the output on each row? Is that sort of the > idea? I guess this thread should better be continued in gnu.emacs.help... As I said before, dired will probably get confused if you change the buffer contents. So, I take it back, using ls-lisp is not really helpful here. I would use an after advice on `dired-insert-set-properties' that uses the display text property to display the wc where you want, like this for the start: --8<---------------cut here---------------start------------->8--- (defun my-dired-insert-add-wc (beg end) (save-excursion (goto-char beg) (while (< (point) end) (condition-case nil (when (dired-move-to-filename) ()) (error nil)) (forward-line 1)))) (advice-add 'dired-insert-set-properties :after #'my-dired-insert-add-wc) --8<---------------cut here---------------end--------------->8--- I use something similar to show directory contents in a tooltip in dired buffers. The text properties could be attached to a space character somewhere. You could use the invisible text property like dired-hide-details-mode to make the wc invisible if you want to hide it. This advice will probably make dired start quite slowly for larger directories, so you should handle that case somehow. Opening all files in a directory to count their line numbers is rather time consuming, dunno if it's really a good idea. Regards, Michael.