[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10624: Dired-marking all files in the region
From: |
Juri Linkov |
Subject: |
bug#10624: Dired-marking all files in the region |
Date: |
Thu, 22 Nov 2012 11:49:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
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.
- bug#10624: Dired-marking all files in the region,
Juri Linkov <=
- bug#10624: Dired-marking all files in the region, Drew Adams, 2012/11/22
- bug#10624: Dired-marking all files in the region, Juri Linkov, 2012/11/23
- bug#10624: Dired-marking all files in the region, Drew Adams, 2012/11/23
- bug#10624: Dired-marking all files in the region, Juri Linkov, 2012/11/25
- bug#10624: Dired-marking all files in the region, Drew Adams, 2012/11/25
- bug#10624: Dired-marking all files in the region, Juri Linkov, 2012/11/25
- bug#10624: Dired-marking all files in the region, Drew Adams, 2012/11/25
bug#10624: Dired-marking all files in the region, Stefan Monnier, 2012/11/22