aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/dired.el38
1 files changed, 22 insertions, 16 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 9d0fd907eea..4cdc1dab066 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1770,26 +1770,32 @@ OLD and NEW are both characters used to mark files."
1770 (match-end 0) old new)))))) 1770 (match-end 0) old new))))))
1771 1771
1772(defun dired-unmark-all-files (mark &optional arg) 1772(defun dired-unmark-all-files (mark &optional arg)
1773 "Remove a specific mark or any mark from every file. 1773 "Remove a specific mark (or any mark) from every file.
1774After this command, type the mark character to remove,
1775or type RET to remove all marks.
1774With prefix arg, query for each marked file. 1776With prefix arg, query for each marked file.
1775Type \\[help-command] at that time for help." 1777Type \\[help-command] at that time for help."
1776 (interactive "sRemove marks (RET means all): \nP") 1778 (interactive "cRemove marks (RET means all): \nP")
1777 (let ((count 0) 1779 (save-excursion
1778 (re (if (zerop (length mark)) dired-re-mark 1780 (let* ((count 0)
1779 (concat "^" (regexp-quote mark))))) 1781 buffer-read-only case-fold-search query
1780 (save-excursion 1782 (string (format "\n%c" mark))
1781 (let (buffer-read-only case-fold-search query 1783 (help-form "\
1782 (help-form "\
1783Type SPC or `y' to unmark one file, DEL or `n' to skip to next, 1784Type SPC or `y' to unmark one file, DEL or `n' to skip to next,
1784`!' to unmark all remaining files with no more questions.")) 1785`!' to unmark all remaining files with no more questions."))
1785 (goto-char (point-min)) 1786 (goto-char (point-min))
1786 (while (re-search-forward re nil t) 1787 (while (if (eq mark ?\r)
1787 (if (or (not arg) 1788 (re-search-forward dired-re-mark nil t)
1788 (dired-query 'query "Unmark file `%s'? " 1789 (search-forward string nil t))
1789 (dired-get-filename t))) 1790 (if (or (not arg)
1790 (progn (delete-char -1) (insert " ") (setq count (1+ count)))) 1791 (dired-query 'query "Unmark file `%s'? "
1791 (forward-line 1)))) 1792 (dired-get-filename t)))
1792 (message "%s" (format "Marks removed: %d %s" count mark)))) 1793 (progn (subst-char-in-region (1- (point)) (point)
1794 (preceding-char) ?\ )
1795 (setq count (1+ count)))))
1796 (message (if (= count 1) "1 mark removed"
1797 "%d marks removed")
1798 count))))
1793 1799
1794;; Logging failures operating on files, and showing the results. 1800;; Logging failures operating on files, and showing the results.
1795 1801