1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Improve error handling in dired-change-marks

* lisp/dired.el (dired-change-marks): Signal user-error if mark
character is invalid.  Catch more invalid characters.  (Bug#29842)
This commit is contained in:
Stefan Kangas 2020-01-19 15:58:06 +01:00
parent 3d81d2326a
commit e5e31aab9b

View file

@ -3868,19 +3868,21 @@ OLD and NEW are both characters used to mark files."
(new (progn (message "Change %c marks to (new mark): " old)
(read-char))))
(list old new)))
(if (or (eq old ?\r) (eq new ?\r))
(ding)
(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)))))))
(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))))))
(defun dired-unmark-all-marks ()
"Remove all marks from all files in the Dired buffer."