*** New command and keystroke `dired-number-of-marked-files' bound to
`* N'.
+*** The marking commands now report how many files were marked by the
+command itself, not how many files are marked in total.
+
** Find-Dired
*** New customizable variable 'find-dired-refine-function'.
;;; 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'.
"")))
(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)