Function: dired-toggle-marks
dired-toggle-marks is an interactive and byte-compiled function
defined in dired.el.gz.
Signature
(dired-toggle-marks)
Documentation
Toggle marks: marked files become unmarked, and vice versa.
Flagged files (indicated with flags such as C and D, not
with *) are not affected, and . and .. are never toggled.
As always, hidden subdirs are not affected.
In Transient Mark mode, if the mark is active, operate on the contents
of the region if dired-mark-region is non-nil. Otherwise, operate
on the whole buffer.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-toggle-marks ()
"Toggle marks: marked files become unmarked, and vice versa.
Flagged files (indicated with flags such as `C' and `D', not
with `*') are not affected, and `.' and `..' are never toggled.
As always, hidden subdirs are not affected.
In Transient Mark mode, if the mark is active, operate on the contents
of the region if `dired-mark-region' is non-nil. Otherwise, operate
on the whole buffer."
(interactive nil dired-mode)
(save-excursion
(let ((inhibit-read-only t)
(beg (dired-mark--region-beginning))
(end (dired-mark--region-end)))
(goto-char beg)
(while (< (point) end)
(or (dired-between-files)
(looking-at-p dired-re-dot)
;; use subst instead of insdel because it does not move
;; the gap and thus should be faster and because
;; other characters are left alone automatically
(apply #'subst-char-in-region
(point) (1+ (point))
(if (eq ?\s (following-char))
(list ?\s dired-marker-char)
(list dired-marker-char ?\s))))
(forward-line 1)))))