From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#10624: Dired-marking all files in the region Date: Mon, 17 Sep 2012 02:45:31 +0300 Organization: JURTA Message-ID: <87fw6his5w.fsf_-_@mail.jurta.org> References: <0F10A2A4C6E541469381BA91CB8AEEB3@us.oracle.com> <60BBA8177B8C4157BBB5426B2F6A8204@us.oracle.com> <87392k2ml9.fsf@mail.jurta.org> <4200B2318C4140E68FA74B61375885B9@us.oracle.com> <87sjaj2atc.fsf@mail.jurta.org> <96319E709DC548DBADB263DA2DD11A82@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347840119 23203 80.91.229.3 (17 Sep 2012 00:01:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2012 00:01:59 +0000 (UTC) Cc: 10624@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 17 02:02:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TDOmm-00033k-Rf for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2012 02:02:01 +0200 Original-Received: from localhost ([::1]:35718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOmi-00017R-Qk for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Sep 2012 20:01:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOme-00016M-Ii for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDOmd-0001OF-A1 for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDOmd-0001OA-6k for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:01:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TDOnm-0006E8-1E for bug-gnu-emacs@gnu.org; Sun, 16 Sep 2012 20:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Sep 2012 00:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10624 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10624-submit@debbugs.gnu.org id=B10624.134784013823869 (code B ref 10624); Mon, 17 Sep 2012 00:03:01 +0000 Original-Received: (at 10624) by debbugs.gnu.org; 17 Sep 2012 00:02:18 +0000 Original-Received: from localhost ([127.0.0.1]:37838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDOn3-0006Cv-Nu for submit@debbugs.gnu.org; Sun, 16 Sep 2012 20:02:18 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:36494 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDOmz-0006Cg-EC for 10624@debbugs.gnu.org; Sun, 16 Sep 2012 20:02:15 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 61AA7451CAEE; Sun, 16 Sep 2012 17:01:00 -0700 (PDT) In-Reply-To: <96319E709DC548DBADB263DA2DD11A82@us.oracle.com> (Drew Adams's message of "Sat, 15 Sep 2012 21:47:22 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64474 Archived-At: >>> 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)))