Subject: Re: bug#6148: add ability to hide unregistered files in vc-dir

From: Magnus Henoch <[email-masked]>
Date: Mon, 10 May 2010 12:30:26 +0100

This piece of code has been in my .emacs for a while:

(defun my-vc-dir-hide-some (states)
  "Hide files whose state is in STATES."
  (interactive
   (list
    (progn
      (unless vc-ewoc
	(error "Not in a vc-dir buffer"))
      (mapcar 'intern
	      (completing-read-multiple
	       "Hide files that are in state(s): "
	       (let (possible-states)
		 (ewoc-map (lambda (item)
			     (let ((state (vc-dir-fileinfo->state item)))
			       (when state
				 (pushnew state possible-states))
			       nil))
			   vc-ewoc)
		 (mapcar 'symbol-name possible-states))
	       nil t)))))
  (let ((inhibit-read-only t))
    (ewoc-filter vc-ewoc
		 (lambda (file)
		   (not (memq (vc-dir-fileinfo->state file) states))))))
(eval-after-load "vc-dir"
  '(define-key vc-dir-mode-map "H" 'my-vc-dir-hide-some))

-- 
Magnus Henoch