[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes
From: |
Lars Ingebrigtsen |
Subject: |
bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes |
Date: |
Wed, 26 Jun 2019 01:12:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Yes, I think I understand. My problem is that "[...] not how many files
> are marked in total" sounds like as if marked files that were not even
> touched by the command (that are not matched by the predicate) were
> previously included. You mean it relative to the files matched, right?
Well... this is the patch:
- (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))))
So if the predicate matches, if there was a mark, it would delete the
mark, and then add it back, and then count it.
But you're right, files where the predicate doesn't say non-nil are not
counted, so it doesn't report the total number of marked files...
> Oh, btw, this patch line
>
> (looking-at-p (char-to-string dired-marker-char))
>
> is not good if dired-marker-char is a regexp special like . or ?, I
> guess (regexp-quote missing)?
Indeed. I'll fix it.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Lars Ingebrigtsen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Drew Adams, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Lars Ingebrigtsen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Michael Heerdegen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Lars Ingebrigtsen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Michael Heerdegen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes,
Lars Ingebrigtsen <=
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Drew Adams, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Michael Heerdegen, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Drew Adams, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Andreas Schwab, 2019/06/26
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Drew Adams, 2019/06/26
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Drew Adams, 2019/06/25
- bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Michael Heerdegen, 2019/06/25
bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes, Lars Ingebrigtsen, 2019/06/25