unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 49554@debbugs.gnu.org
Subject: bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files
Date: Tue, 13 Jul 2021 22:30:00 +0200	[thread overview]
Message-ID: <m1a6mq0xfb.fsf@yahoo.es> (raw)
In-Reply-To: m1a6mq0xfb.fsf.ref@yahoo.es

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


       reply	other threads:[~2021-07-13 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2021-07-13 20:39   ` bug#49554: 28.0.50; [PATCH] dired-number-of-marked-files doesn't work correctly when there are no marked files Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1a6mq0xfb.fsf@yahoo.es \
    --to=bug-gnu-emacs@gnu.org \
    --cc=49554@debbugs.gnu.org \
    --cc=mardani29@yahoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).