* bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files
[not found] <m1a6mq0xfb.fsf.ref@yahoo.es>
@ 2021-07-13 20:30 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-13 20:39 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-13 20:30 UTC (permalink / raw)
To: 49554
[-- Attachment #1: Type: text/plain, Size: 343 bytes --]
Steps to reproduce the problem:
emacs -Q
Open a directory with files in Dired.
* N
Actual results:
The echo area shows "0 files marked (total size XX)".
After reading the source code, I think it should only show "No marked
files", but there's a syntax mistake in an if expression. I've attached
a patch to correct the problem. Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-dired-number-of-marked-files-when-there-are-no-m.patch --]
[-- Type: text/x-patch, Size: 1440 bytes --]
From f31d307582c4a1350dc0572b651ee3faeb2d66c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Tue, 13 Jul 2021 22:09:43 +0200
Subject: [PATCH] Fix dired-number-of-marked-files when there are no marked
files
* lisp/dired.el (dired-number-of-marked-files): Fix if expression so
that the else part is evaluated correctly.
---
lisp/dired.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lisp/dired.el b/lisp/dired.el
index fb353a92e4..7f24f752f7 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3836,13 +3836,13 @@ dired-number-of-marked-files
when (stringp file)
sum (file-attribute-size (file-attributes file)))))
(if (zerop nmarked)
- (message "No marked files"))
- (message "%d marked file%s (%s total size)"
- nmarked
- (if (= nmarked 1)
- ""
- "s")
- (funcall byte-count-to-string-function size))))
+ (message "No marked files")
+ (message "%d marked file%s (%s total size)"
+ nmarked
+ (if (= nmarked 1)
+ ""
+ "s")
+ (funcall byte-count-to-string-function size)))))
(defun dired-mark-files-containing-regexp (regexp &optional marker-char)
"Mark all files with contents containing REGEXP for use in later commands.
--
2.31.0
^ permalink raw reply related [flat|nested] 2+ messages in thread