unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files
  2021-07-13 20:30 ` bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files 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, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-13 20:39 UTC (permalink / raw)
  To: 49554; +Cc: mardani29

Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> 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.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-13 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m1a6mq0xfb.fsf.ref@yahoo.es>
2021-07-13 20:30 ` bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-13 20:39   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).