From e2f022a3fa6986eea4df942dc52a00ae70ec193f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sat, 27 Oct 2012 12:17:14 +0300 Subject: [PATCH] * lisp/wdired.el (wdired-keep-marker-rename): New defcustom. (wdired-do-renames): Use it instead of `dired-keep-marker-rename'. * lisp/dired.el (dired-keep-marker-rename): Add reference to `wdired-keep-marker-rename' in the docstring. Add default character value ?R to display initially in Customization UI instead of ?@. Fixes: debbugs:11795 --- lisp/ChangeLog | 11 +++++++++++ lisp/dired.el | 7 +++++-- lisp/wdired.el | 25 ++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index defa35f09ee..c6e940ba0fa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2012-10-27 Juri Linkov + + * wdired.el (wdired-keep-marker-rename): New defcustom. + (wdired-do-renames): Use it instead of `dired-keep-marker-rename'. + (Bug#11795) + + * dired.el (dired-keep-marker-rename): Add reference to + `wdired-keep-marker-rename' in the docstring. + Add default character value ?R to display initially in + Customization UI instead of ?@. + 2012-10-27 Martin Rudalics * window.el (display-buffer): In doc-string describe diff --git a/lisp/dired.el b/lisp/dired.el index fb2f7281130..5f7ee48a810 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -137,9 +137,12 @@ A value of t means move to first file." "Controls marking of renamed files. If t, files keep their previous marks when they are renamed. If a character, renamed files (whether previously marked or not) -are afterward marked with that character." +are afterward marked with that character. +This option affects only files renamed by `dired-do-rename' and +`dired-do-rename-regexp'. See `wdired-keep-marker-rename' +if you want to do the same for files renamed in WDired mode." :type '(choice (const :tag "Keep" t) - (character :tag "Mark")) + (character :tag "Mark" :value ?R)) :group 'dired-mark) (defcustom dired-keep-marker-copy ?C diff --git a/lisp/wdired.el b/lisp/wdired.el index 266d1993389..9851b2046d9 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -140,6 +140,20 @@ program `dired-chmod-program', which must exist." (other :tag "Bits freely editable" advanced)) :group 'wdired) +(defcustom wdired-keep-marker-rename t + ;; Use t as default so that renamed files "take their markers with them". + "Controls marking of files renamed in WDired. +If t, files keep their previous marks when they are renamed. +If a character, renamed files (whether previously marked or not) +are afterward marked with that character. +This option affects only files renamed by `wdired-finish-edit'. +See `dired-keep-marker-rename' if you want to do the same for files +renamed by `dired-do-rename' and `dired-do-rename-regexp'." + :type '(choice (const :tag "Keep" t) + (character :tag "Mark" :value ?R)) + :version "24.3" + :group 'wdired) + (defvar wdired-mode-map (let ((map (make-sparse-keymap))) (define-key map "\C-x\C-s" 'wdired-finish-edit) @@ -416,6 +430,8 @@ non-nil means return old filename." (set-buffer-modified-p nil) (setq buffer-undo-list nil)) +(declare-function dired-add-entry "dired-aux" (filename &optional marker-char relative)) + (defun wdired-do-renames (renames) "Perform RENAMES in parallel." (let ((residue ()) @@ -471,9 +487,12 @@ non-nil means return old filename." (dired-rename-file file-ori file-new overwrite) (dired-remove-file file-ori) - (dired-add-file file-new (if (integerp dired-keep-marker-rename) - dired-keep-marker-rename - old-mark))) + (dired-add-file + file-new + (cond ((integerp wdired-keep-marker-rename) + wdired-keep-marker-rename) + (wdired-keep-marker-rename old-mark) + (t nil)))) (error (setq errors (1+ errors)) (dired-log (concat "Rename `" file-ori "' to `" -- 2.39.5