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: Thu, 22 Nov 2012 11:49:57 +0200 Organization: JURTA Message-ID: <87ehjmrmzg.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> <87fw6his5w.fsf_-_@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1353577919 16034 80.91.229.3 (22 Nov 2012 09:51:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Nov 2012 09:51:59 +0000 (UTC) To: 10624@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 22 10:52:10 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 1TbTS5-0006kF-Ko for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Nov 2012 10:52:09 +0100 Original-Received: from localhost ([::1]:45236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbTRv-0008JT-6x for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Nov 2012 04:51:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbTRn-0008E2-B8 for bug-gnu-emacs@gnu.org; Thu, 22 Nov 2012 04:51:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbTRf-0000By-GF for bug-gnu-emacs@gnu.org; Thu, 22 Nov 2012 04:51:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbTRf-0000Bt-CE for bug-gnu-emacs@gnu.org; Thu, 22 Nov 2012 04:51:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TbTSw-0001z9-Fg for bug-gnu-emacs@gnu.org; Thu, 22 Nov 2012 04:53:02 -0500 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: Thu, 22 Nov 2012 09:53:02 +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.13535779567598 (code B ref 10624); Thu, 22 Nov 2012 09:53:02 +0000 Original-Received: (at 10624) by debbugs.gnu.org; 22 Nov 2012 09:52:36 +0000 Original-Received: from localhost ([127.0.0.1]:60356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TbTSW-0001yV-Bx for submit@debbugs.gnu.org; Thu, 22 Nov 2012 04:52:36 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:44306 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TbTST-0001yL-R9 for 10624@debbugs.gnu.org; Thu, 22 Nov 2012 04:52:34 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id C952B451C074 for <10624@debbugs.gnu.org>; Thu, 22 Nov 2012 01:51:12 -0800 (PST) In-Reply-To: <87fw6his5w.fsf_-_@mail.jurta.org> (Juri Linkov's message of "Mon, 17 Sep 2012 02:45:31 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.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.x 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:67307 Archived-At: While testing changes for WDired, I noticed one potential problem with marking all files in the region in the Dired buffer: when the region is active before typing `C-c C-c' in WDired it marks renamed files with the same marker, because currently WDired uses `dired-add-entry' that calls `dired-mark'. This is a rare problem, but I'd like to fix it properly. IIUC, the right way to enable functionality only for interactive use is to add an `interactive' arg (there were some reasons not to use (called-interactively-p 'interactive) but I forgot the exact reasons). This is not a regression, so I'm not sure about installing it to the emacs-24 branch: === modified file 'lisp/dired.el' --- lisp/dired.el 2012-11-17 21:52:12 +0000 +++ lisp/dired.el 2012-11-22 09:49:38 +0000 @@ -3109,7 +3109,7 @@ (defun dired-mark-files-in-region (start (insert dired-marker-char))) (forward-line 1)))) -(defun dired-mark (arg) +(defun dired-mark (arg &optional interactive) "Mark the file at point in the Dired buffer. If the region is active, mark all files in the region. Otherwise, with a prefix arg, mark files on the next ARG lines. @@ -3119,10 +3119,10 @@ (defun dired-mark (arg) Use \\[dired-unmark-all-files] to remove all marks and \\[dired-unmark] on a subdir to remove the marks in this subdir." - (interactive "P") + (interactive (list current-prefix-arg t)) (cond ;; Mark files in the active region. - ((and transient-mark-mode mark-active) + ((and interactive (use-region-p)) (save-excursion (let ((beg (region-beginning)) (end (region-end))) @@ -3139,7 +3139,7 @@ (defun dired-mark (arg) (prefix-numeric-value arg) (function (lambda () (delete-char 1) (insert dired-marker-char)))))))) -(defun dired-unmark (arg) +(defun dired-unmark (arg &optional interactive) "Unmark the file at point in the Dired buffer. If the region is active, unmark all files in the region. Otherwise, with a prefix arg, unmark files on the next ARG lines. @@ -3147,11 +3147,11 @@ (defun dired-unmark (arg) 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") + (interactive (list current-prefix-arg t)) (let ((dired-marker-char ?\040)) - (dired-mark arg))) + (dired-mark arg interactive))) -(defun dired-flag-file-deletion (arg) +(defun dired-flag-file-deletion (arg &optional interactive) "In Dired, flag the current line's file for deletion. If the region is active, flag all files in the region. Otherwise, with a prefix arg, flag files on the next ARG lines. @@ -3159,9 +3159,9 @@ (defun dired-flag-file-deletion (arg) 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") + (interactive (list current-prefix-arg t)) (let ((dired-marker-char dired-del-marker)) - (dired-mark arg))) + (dired-mark arg interactive))) (defun dired-unmark-backward (arg) "In Dired, move up lines and remove marks or deletion flags there.