unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 10624@debbugs.gnu.org
Subject: bug#10624: Dired-marking all files in the region
Date: Thu, 22 Nov 2012 11:49:57 +0200	[thread overview]
Message-ID: <87ehjmrmzg.fsf@mail.jurta.org> (raw)
In-Reply-To: <87fw6his5w.fsf_-_@mail.jurta.org> (Juri Linkov's message of "Mon, 17 Sep 2012 02:45:31 +0300")

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.






  reply	other threads:[~2012-11-22  9:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 15:35 bug#10624: 24.0.92; default value of `dired-do-ch*' Drew Adams
2012-01-27 16:23 ` Drew Adams
2012-09-14 23:47   ` Juri Linkov
2012-09-15  0:37     ` Drew Adams
2012-09-15 22:50       ` Juri Linkov
2012-09-16  4:47         ` Drew Adams
2012-09-16 23:48           ` Juri Linkov
2012-09-17  0:39             ` Drew Adams
2012-09-18 23:22             ` Juri Linkov
2012-09-15 22:54       ` Juri Linkov
2012-09-16  4:47         ` Drew Adams
2012-09-16 23:45           ` bug#10624: Dired-marking all files in the region Juri Linkov
2012-11-22  9:49             ` Juri Linkov [this message]
2012-11-22 15:27               ` Drew Adams
2012-11-23  7:51                 ` Juri Linkov
2012-11-23 17:12                   ` Drew Adams
2012-11-25  9:16                     ` Juri Linkov
2012-11-25 15:49                       ` Drew Adams
2012-11-25 16:12                         ` Juri Linkov
2012-11-25 17:02                           ` Drew Adams
2012-11-22 15:40               ` Stefan Monnier
2012-11-23  7:59                 ` Juri Linkov

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehjmrmzg.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=10624@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).