all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22829: 25.1.50; Display number of marked files
@ 2016-02-27 14:29 Tino Calancha
       [not found] ` <handler.22829.B.145658318020704.ack@debbugs.gnu.org>
  2016-03-01 11:26 ` bug#22829: 25.1.50; Display number of marked files Constantino Calancha
  0 siblings, 2 replies; 22+ messages in thread
From: Tino Calancha @ 2016-02-27 14:29 UTC (permalink / raw)
  To: 22829

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]


Added a function displaying the number of marked files in the minibuffer.
Such function could be bound to 'N'.

In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.29)
Repository revision: 25c5651951ef39f650927652dac8b4bbfccb60fa

[-- Attachment #2: Type: text/plain, Size: 1720 bytes --]

diff --git a/lisp/dired.el b/lisp/dired.el
index 6c7445c..314a701 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" nmarked) 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.

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

end of thread, other threads:[~2019-06-25 14:29 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` bug#22829: Acknowledgement (25.1.50; Display number of marked files) Tino Calancha
2016-02-28  5:38     ` 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

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.