summaryrefslogtreecommitdiff
path: root/lisp/dired.el
diff options
context:
space:
mode:
authorDrew Adams <drew.adams@oracle.com>2019-06-25 17:42:25 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-25 17:44:56 +0200
commit90c25b245259e99013dfb9292bea054a0ab4ffb6 (patch)
tree1d097d953f14ae89dfb075bc755d766c431f44f5 /lisp/dired.el
parentda263640c8157ddf9a9656f45ec7e8afcbcadbb4 (diff)
downloademacs-90c25b245259e99013dfb9292bea054a0ab4ffb6.tar.gz
Make dired commands report how many files they mark
* lisp/dired.el (dired-mark-if): Report the number of files marked when called, not the total number of marked files (bug#22457).
Diffstat (limited to 'lisp/dired.el')
-rw-r--r--lisp/dired.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index ce82093bf09..5618b25f6f9 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -538,7 +538,7 @@ Subexpression 2 must end right before the \\n.")
;;; Macros must be defined before they are used, for the byte compiler.
(defmacro dired-mark-if (predicate msg)
- "Mark all files for which PREDICATE evals to non-nil.
+ "Mark files for PREDICATE, according to `dired-marker-char'.
PREDICATE is evaluated on each line, with point at beginning of line.
MSG is a noun phrase for the type of files being marked.
It should end with a noun that can be pluralized by adding `s'.
@@ -558,13 +558,13 @@ Return value is the number of files marked, or nil if none were marked."
"")))
(goto-char (point-min))
(while (not (eobp))
- (if ,predicate
- (progn
- (delete-char 1)
- (insert dired-marker-char)
- (setq count (1+ count))))
+ (when ,predicate
+ (unless (looking-at-p (char-to-string dired-marker-char))
+ (delete-char 1)
+ (insert dired-marker-char)
+ (setq count (1+ count))))
(forward-line 1))
- (if ,msg (message "%s %s%s %s%s."
+ (when ,msg (message "%s %s%s %s%s"
count
,msg
(dired-plural-s count)