Function: dired-change-marks

dired-change-marks is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-change-marks OLD NEW)

Documentation

Change all OLD marks to NEW marks.

OLD and NEW are both characters used to mark files.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-change-marks (&optional old new)
  "Change all OLD marks to NEW marks.
OLD and NEW are both characters used to mark files."
  (declare (advertised-calling-convention (old new) "28.1"))
  (interactive
   (let* ((cursor-in-echo-area t)
	  (old (progn (message "Change (old mark): ") (read-char)))
	  (new (progn (message  "Change %c marks to (new mark): " old)
		      (read-char))))
     (list old new))
   dired-mode)
  (dolist (c (list new old))
    (if (or (not (char-displayable-p c))
            (eq c ?\r))
        (user-error "Invalid mark character: `%c'" c)))
  (let ((string (format "\n%c" old))
        (inhibit-read-only t))
    (save-excursion
      (goto-char (point-min))
      (while (search-forward string nil t)
        (if (if (= old ?\s)
                (save-match-data
                  (dired-get-filename 'no-dir t))
              t)
            (subst-char-in-region (match-beginning 0)
                                  (match-end 0) old new))))))