Function: dired-mark-unmarked-files

dired-mark-unmarked-files is an interactive and byte-compiled function defined in dired-x.el.gz.

Signature

(dired-mark-unmarked-files REGEXP MSG &optional UNFLAG-P LOCALP CASE-FOLD-P)

Documentation

Mark unmarked files matching REGEXP, displaying MSG.

REGEXP is matched against the entire file name. When called interactively, prompt for REGEXP. With prefix argument, unflag all those files. Optional fourth argument LOCALP is as in dired-get-filename. Optional fifth argument CASE-FOLD-P specifies the value of case-fold-search used for matching REGEXP. If the region is active in Transient Mark mode, operate only on files in the active region if dired-mark-region is non-nil.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-x.el.gz
;; Returns t if any work was done, nil otherwise.
(defun dired-mark-unmarked-files (regexp msg &optional unflag-p localp case-fold-p)
  "Mark unmarked files matching REGEXP, displaying MSG.
REGEXP is matched against the entire file name.  When called
interactively, prompt for REGEXP.
With prefix argument, unflag all those files.
Optional fourth argument LOCALP is as in `dired-get-filename'.
Optional fifth argument CASE-FOLD-P specifies the value of
`case-fold-search' used for matching REGEXP.
If the region is active in Transient Mark mode, operate only on
files in the active region if `dired-mark-region' is non-nil."
  (interactive
   (list (read-regexp
          (format-prompt "Mark unmarked files matching regexp" "all")
          nil 'dired-regexp-history)
	 nil current-prefix-arg nil)
   dired-mode)
  (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
    (dired-mark-if
     (and
      (if unflag-p
          ;; Already marked.
          (not (= (following-char) ?\s))
        ;; Not already marked.
        (= (following-char) ?\s))
      ;; Interesting.
      (let ((fn (dired-get-filename localp t))
            ;; Match patterns case-insensitively on case-insensitive
            ;; systems
            (case-fold-search case-fold-p))
        (and fn (string-match-p regexp fn))))
     msg)))