Function: dired-mark-extension

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

Signature

(dired-mark-extension EXTENSION &optional MARKER-CHAR)

Documentation

Mark all files with a certain EXTENSION for use in later commands.

A . is automatically prepended to EXTENSION when not present. EXTENSION may also be a list of extensions instead of a single one. Optional MARKER-CHAR is marker to use. Interactively, ask for EXTENSION. Prefixed with one C-u (universal-argument), unmark files instead. Prefixed with two C-u (universal-argument)'s, prompt for MARKER-CHAR and mark files with it.

Probably introduced at or before Emacs version 26.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-x.el.gz
;; Mark files with some extension.
(defun dired-mark-extension (extension &optional marker-char)
  "Mark all files with a certain EXTENSION for use in later commands.
A `.' is automatically prepended to EXTENSION when not present.
EXTENSION may also be a list of extensions instead of a single one.
Optional MARKER-CHAR is marker to use.
Interactively, ask for EXTENSION.
Prefixed with one \\[universal-argument], unmark files instead.
Prefixed with two \\[universal-argument]'s, prompt for MARKER-CHAR and mark files with it."
  (interactive (dired--mark-suffix-interactive-spec) dired-mode)
  (setq extension (ensure-list extension))
  (dired-mark-files-regexp
   (concat ".";; don't match names with nothing but an extension
           "\\("
           (mapconcat
            (lambda (x)
              (regexp-quote
               (if (string-prefix-p "." x) x (concat "." x))))
            extension "\\|")
           "\\)$")
   marker-char))