unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to get `item in directory' count in dired
@ 2008-02-14  6:01 reader
  2008-02-16 15:25 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: reader @ 2008-02-14  6:01 UTC (permalink / raw)
  To: help-gnu-emacs

How can I have a permanent item count in the directory view.  Maybe in
the mode line or something.

I want to see how many files/directories are in the dired buffer at a glance
without keyboard cmds or other effort.





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

* Re: How to get `item in directory' count in dired
  2008-02-14  6:01 How to get `item in directory' count in dired reader
@ 2008-02-16 15:25 ` Kevin Rodgers
  2008-02-17 17:24   ` reader
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2008-02-16 15:25 UTC (permalink / raw)
  To: help-gnu-emacs

reader@newsguy.com wrote:
> How can I have a permanent item count in the directory view.  Maybe in
> the mode line or something.
> 
> I want to see how many files/directories are in the dired buffer at a glance
> without keyboard cmds or other effort.

Nice exercise:

(define-minor-mode dired-count-files-mode
   "*Display the number of files in the Dired mode line."
   nil (:eval (format " %d files" dired-count-files)) nil
   (if dired-count-files-mode
       (progn
	(add-hook 'dired-before-readin-hook 'dired-count-files-reset)
	(add-hook 'dired-after-readin-hook 'dired-count-files-total))
     (progn
       (remove-hook 'dired-before-readin-hook 'dired-count-files-reset)
       (remove-hook 'dired-after-readin-hook 'dired-count-files-total))))

(defvar dired-count-files 0
   "The number of files in the Dired buffer.")

(defun dired-count-files-reset ()
   (set (make-local-variable 'dired-count-files) 0))

(defun dired-count-files-total ()
   (goto-char (point-min))
   (search-forward-regexp dired-move-to-filename-regexp nil t)
   (set (make-local-variable 'dired-count-files)
        (+ dired-count-files (count-lines (line-beginning-position) 
(point-max)))))


-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: How to get `item in directory' count in dired
  2008-02-16 15:25 ` Kevin Rodgers
@ 2008-02-17 17:24   ` reader
  0 siblings, 0 replies; 3+ messages in thread
From: reader @ 2008-02-17 17:24 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> reader@newsguy.com wrote:
>> How can I have a permanent item count in the directory view.  Maybe in
>> the mode line or something.
>>
>> I want to see how many files/directories are in the dired buffer at a glance
>> without keyboard cmds or other effort.
>
> Nice exercise:

Thanks... Well above my skill level... but copy/paste rules : )





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

end of thread, other threads:[~2008-02-17 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14  6:01 How to get `item in directory' count in dired reader
2008-02-16 15:25 ` Kevin Rodgers
2008-02-17 17:24   ` reader

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).