Function: vc-dir-mark-all-files

vc-dir-mark-all-files is an interactive and byte-compiled function defined in vc-dir.el.gz.

Signature

(vc-dir-mark-all-files ARG)

Documentation

Mark all files with the same state as the current one.

With prefix argument ARG, mark all files (not directories). If the current entry is a directory, mark all child files.

The commands operate on files that are on the same state. This command is intended to make it easy to select all files that share the same state.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defun vc-dir-mark-all-files (arg)
  "Mark all files with the same state as the current one.
With prefix argument ARG, mark all files (not directories).
If the current entry is a directory, mark all child files.

The commands operate on files that are on the same state.
This command is intended to make it easy to select all files that
share the same state."
  (interactive "P")
  (if arg
      ;; Mark all files.
      (progn
	;; First check that no directory is marked, we can't mark
	;; files in that case.
	(ewoc-map
	 (lambda (filearg)
	   (when (and (vc-dir-fileinfo->directory filearg)
		      (vc-dir-fileinfo->marked filearg))
	     (error "Cannot mark all files, directory `%s' marked"
		    (vc-dir-fileinfo->name filearg))))
	 vc-ewoc)
	(ewoc-map
	 (lambda (filearg)
	   (unless (or (vc-dir-fileinfo->directory filearg)
                       (vc-dir-fileinfo->marked filearg))
	     (setf (vc-dir-fileinfo->marked filearg) t)
	     t))
	 vc-ewoc))
    (let* ((crt  (ewoc-locate vc-ewoc))
	   (data (ewoc-data crt)))
      (if (vc-dir-fileinfo->directory data)
	  ;; It's a directory, mark child files.
	  (let (crt-data)
	    (while (and (setq crt (ewoc-next vc-ewoc crt))
			(setq crt-data (ewoc-data crt))
			(not (vc-dir-fileinfo->directory crt-data)))
	      (setf (vc-dir-fileinfo->marked crt-data) t)
	      (ewoc-invalidate vc-ewoc crt)))
	;; It's a file
	(let ((state (vc-dir-fileinfo->state data)))
	  (setq crt (ewoc-nth vc-ewoc 0))
	  (while crt
	    (let ((crt-data (ewoc-data crt)))
	      (when (and (not (vc-dir-fileinfo->marked crt-data))
			 (eq (vc-dir-fileinfo->state crt-data) state)
			 (not (vc-dir-fileinfo->directory crt-data)))
		(vc-dir-mark-file crt)))
	    (setq crt (ewoc-next vc-ewoc crt))))))))