aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew Adams2019-06-25 17:42:25 +0200
committerLars Ingebrigtsen2019-06-25 17:44:56 +0200
commit90c25b245259e99013dfb9292bea054a0ab4ffb6 (patch)
tree1d097d953f14ae89dfb075bc755d766c431f44f5
parentda263640c8157ddf9a9656f45ec7e8afcbcadbb4 (diff)
downloademacs-90c25b245259e99013dfb9292bea054a0ab4ffb6.tar.gz
emacs-90c25b245259e99013dfb9292bea054a0ab4ffb6.zip
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).
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/dired.el14
2 files changed, 10 insertions, 7 deletions
diff --git a/etc/NEWS b/etc/NEWS
index efe25014636..3b229ae1c14 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -611,6 +611,9 @@ remapped to these, respectively.
611*** New command and keystroke `dired-number-of-marked-files' bound to 611*** New command and keystroke `dired-number-of-marked-files' bound to
612`* N'. 612`* N'.
613 613
614*** The marking commands now report how many files were marked by the
615command itself, not how many files are marked in total.
616
614** Find-Dired 617** Find-Dired
615 618
616*** New customizable variable 'find-dired-refine-function'. 619*** New customizable variable 'find-dired-refine-function'.
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.")
538;;; Macros must be defined before they are used, for the byte compiler. 538;;; Macros must be defined before they are used, for the byte compiler.
539 539
540(defmacro dired-mark-if (predicate msg) 540(defmacro dired-mark-if (predicate msg)
541 "Mark all files for which PREDICATE evals to non-nil. 541 "Mark files for PREDICATE, according to `dired-marker-char'.
542PREDICATE is evaluated on each line, with point at beginning of line. 542PREDICATE is evaluated on each line, with point at beginning of line.
543MSG is a noun phrase for the type of files being marked. 543MSG is a noun phrase for the type of files being marked.
544It should end with a noun that can be pluralized by adding `s'. 544It 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."
558 ""))) 558 "")))
559 (goto-char (point-min)) 559 (goto-char (point-min))
560 (while (not (eobp)) 560 (while (not (eobp))
561 (if ,predicate 561 (when ,predicate
562 (progn 562 (unless (looking-at-p (char-to-string dired-marker-char))
563 (delete-char 1) 563 (delete-char 1)
564 (insert dired-marker-char) 564 (insert dired-marker-char)
565 (setq count (1+ count)))) 565 (setq count (1+ count))))
566 (forward-line 1)) 566 (forward-line 1))
567 (if ,msg (message "%s %s%s %s%s." 567 (when ,msg (message "%s %s%s %s%s"
568 count 568 count
569 ,msg 569 ,msg
570 (dired-plural-s count) 570 (dired-plural-s count)