From: Tino Calancha <f92capac@gmail.com>
To: 22829@debbugs.gnu.org
Subject: bug#22829: Acknowledgement (25.1.50; Display number of marked files)
Date: Sat, 27 Feb 2016 23:41:04 +0900 (JST) [thread overview]
Message-ID: <alpine.LRH.2.20.1602272340080.1080@calancha-ilc.kek.jp> (raw)
In-Reply-To: <handler.22829.B.145658318020704.ack@debbugs.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 65 bytes --]
Return the correct value when number of marked files equals 1.
[-- Attachment #2: Type: text/plain, Size: 1717 bytes --]
diff --git a/lisp/dired.el b/lisp/dired.el
index 6c7445c..5814e55 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1505,6 +1505,7 @@ dired-mode-map
(define-key map "*/" 'dired-mark-directories)
(define-key map "*@" 'dired-mark-symlinks)
(define-key map "*%" 'dired-mark-files-regexp)
+ (define-key map "N" 'dired-number-marked-files)
(define-key map "*c" 'dired-change-marks)
(define-key map "*s" 'dired-mark-subdir-files)
(define-key map "*m" 'dired-mark)
@@ -1651,6 +1652,9 @@ dired-mode-map
(define-key map [menu-bar immediate revert-buffer]
'(menu-item "Refresh" revert-buffer
:help "Update contents of shown directories"))
+ (define-key map [menu-bar immediate dired-number-marked-files]
+ '(menu-item "#Marked Files" dired-number-marked-files
+ :help "Display number of marked files"))
(define-key map [menu-bar immediate dashes]
'("--"))
@@ -3345,6 +3349,18 @@ dired-mark-files-regexp
(and fn (string-match-p regexp fn))))
"matching file")))
+(defun dired-number-marked-files()
+ "Display number of marked files"
+ (interactive)
+ (let* ((files (dired-get-marked-files nil nil nil t))
+ (nmarked (length files)))
+ (cond ((null (cdr files))
+ (message "No marked files"))
+ ((and (= nmarked 2) (eq (car files) t))
+ (message "1 marked file") (1- nmarked))
+ (t
+ (message "%d marked files" nmarked) nmarked))))
+
(defun dired-mark-files-containing-regexp (regexp &optional marker-char)
"Mark all files with contents containing REGEXP for use in later commands.
A prefix argument means to unmark them instead.
next prev parent reply other threads:[~2016-02-27 14:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-27 14:29 bug#22829: 25.1.50; Display number of marked files Tino Calancha
[not found] ` <handler.22829.B.145658318020704.ack@debbugs.gnu.org>
2016-02-27 14:41 ` Tino Calancha [this message]
2016-02-28 5:38 ` bug#22829: Acknowledgement (25.1.50; Display number of marked files) Lars Ingebrigtsen
2016-02-28 6:36 ` Tino Calancha
2016-03-02 0:32 ` Juri Linkov
2016-03-02 17:28 ` Lars Ingebrigtsen
2016-03-02 20:04 ` Marcin Borkowski
2016-03-03 0:17 ` Juri Linkov
2016-03-03 5:52 ` Lars Ingebrigtsen
2016-03-03 11:20 ` Richard Stallman
2016-03-03 11:25 ` Lars Ingebrigtsen
2019-06-25 14:29 ` Lars Ingebrigtsen
2016-03-03 9:58 ` Tino Calancha
2016-03-03 12:27 ` Michael Heerdegen
2016-03-03 12:55 ` Constantino Calancha
2019-06-25 14:29 ` Lars Ingebrigtsen
2016-03-07 0:04 ` Juri Linkov
2016-03-08 10:20 ` Tino Calancha
2016-03-08 0:19 ` Juri Linkov
2016-03-08 10:34 ` Tino Calancha
2016-03-09 16:37 ` Richard Stallman
2016-03-01 11:26 ` bug#22829: 25.1.50; Display number of marked files Constantino Calancha
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.20.1602272340080.1080@calancha-ilc.kek.jp \
--to=f92capac@gmail.com \
--cc=22829@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.