GNU bug report logs - #10624
24.0.92; default value of `dired-do-ch*'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Fri, 27 Jan 2012 15:37:01 UTC

Severity: minor

Found in version 24.0.92

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 10624 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 10624 <at> debbugs.gnu.org
Subject: Re: bug#10624: Dired-marking all files in the region
Date: Mon, 17 Sep 2012 02:45:31 +0300
>>> Dired-marking all files in the region
>>
>> This is a feature that's sorely missing from Dired.
>
> But it's been a feature of Dired+ since at least 1999, and probably several
> years before that.  And I've offered that and all other features of Dired+ to
> Emacs Dev multiple times.  Still sorely missing, though.

The size of Dired+ is overwhelming, let's add its features to Dired
one at a time ;-)

Below is a complete tested patch for the region-marking feature:

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2012-09-14 03:55:16 +0000
+++ lisp/dired.el	2012-09-16 23:41:24 +0000
@@ -3097,21 +3115,37 @@ (defun dired-mark-files-in-region (start
 (defun dired-mark (arg)
   "Mark the current (or next ARG) files.
 If on a subdir headerline, mark all its files except `.' and `..'.
+If the region is active in Transient Mark mode, mark all files
+in the active region.
 
 Use \\[dired-unmark-all-files] to remove all marks
 and \\[dired-unmark] on a subdir to remove the marks in
 this subdir."
   (interactive "P")
-  (if (dired-get-subdir)
-      (save-excursion (dired-mark-subdir-files))
+  (cond
+   ;; Mark files in the active region.
+   ((and transient-mark-mode mark-active)
+    (save-excursion
+      (let ((beg (region-beginning))
+	    (end (region-end)))
+	(dired-mark-files-in-region
+	 (progn (goto-char beg) (line-beginning-position))
+	 (progn (goto-char end) (line-beginning-position))))))
+   ;; Mark subdir files from the subdir headerline.
+   ((dired-get-subdir)
+    (save-excursion (dired-mark-subdir-files)))
+   ;; Mark the current (or next ARG) files.
+   (t
     (let ((inhibit-read-only t))
       (dired-repeat-over-lines
        (prefix-numeric-value arg)
-       (function (lambda () (delete-char 1) (insert dired-marker-char)))))))
+       (function (lambda () (delete-char 1) (insert dired-marker-char))))))))
 
 (defun dired-unmark (arg)
   "Unmark the current (or next ARG) files.
-If looking at a subdir, unmark all its files except `.' and `..'."
+If looking at a subdir, unmark all its files except `.' and `..'.
+If the region is active in Transient Mark mode, unmark all files
+in the active region."
   (interactive "P")
   (let ((dired-marker-char ?\040))
     (dired-mark arg)))
@@ -3119,8 +3153,9 @@ (defun dired-unmark (arg)
 (defun dired-flag-file-deletion (arg)
   "In Dired, flag the current line's file for deletion.
 With prefix arg, repeat over several lines.
-
-If on a subdir headerline, mark all its files except `.' and `..'."
+If on a subdir headerline, flag all its files except `.' and `..'.
+If the region is active in Transient Mark mode, flag all files
+in the active region."
   (interactive "P")
   (let ((dired-marker-char dired-del-marker))
     (dired-mark arg)))
@@ -3128,7 +3163,9 @@ (defun dired-flag-file-deletion (arg)
 (defun dired-unmark-backward (arg)
   "In Dired, move up lines and remove marks or deletion flags there.
 Optional prefix ARG says how many lines to unmark/unflag; default
-is one line."
+is one line.
+If the region is active in Transient Mark mode, unmark all files
+in the active region."
   (interactive "p")
   (dired-unmark (- arg)))
 




This bug report was last modified 12 years and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.