From: Michael Heerdegen <michael_heerdegen@web.de>
To: 11795@debbugs.gnu.org
Subject: bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files
Date: Tue, 16 Oct 2012 01:01:36 +0200 [thread overview]
Message-ID: <87y5j7jq5r.fsf@web.de> (raw)
In-Reply-To: <506C01ED.9000906@gmx.at> (martin rudalics's message of "Wed, 03 Oct 2012 11:14:21 +0200")
[-- Attachment #1: Type: text/plain, Size: 188 bytes --]
martin rudalics <rudalics@gmx.at> writes:
> Any chances for a fix to this in the next days?
After performing different tests, my patch looks sane so far. IMHO it
can be installed now.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: wdired.patch --]
[-- Type: text/x-diff, Size: 6394 bytes --]
*** /home/micha/today/wdired.el 2012-10-09 02:27:03.638708806 +0200
--- /home/micha/today/wdired-new.el 2012-10-09 02:24:13.498706008 +0200
***************
*** 180,186 ****
(defvar wdired-col-perm) ;; Column where the permission bits start
(defvar wdired-old-content)
(defvar wdired-old-point)
!
(defun wdired-mode ()
"Writable Dired (WDired) mode.
--- 180,186 ----
(defvar wdired-col-perm) ;; Column where the permission bits start
(defvar wdired-old-content)
(defvar wdired-old-point)
! (defvar wdired-old-marks)
(defun wdired-mode ()
"Writable Dired (WDired) mode.
***************
*** 221,226 ****
--- 221,228 ----
(error "Not a Dired buffer"))
(set (make-local-variable 'wdired-old-content)
(buffer-substring (point-min) (point-max)))
+ (set (make-local-variable 'wdired-old-marks)
+ (dired-remember-marks (point-min) (point-max)))
(set (make-local-variable 'wdired-old-point) (point))
(set (make-local-variable 'query-replace-skip-read-only) t)
(set (make-local-variable 'isearch-filter-predicate)
***************
*** 430,477 ****
(let* ((rename (pop renames))
(file-new (cdr rename)))
(cond
! ((rassoc file-new renames)
! (error "Trying to rename 2 files to the same name"))
! ((assoc file-new renames)
! ;; Renaming to a file name that already exists but will itself be
! ;; renamed as well. Let's wait until that one gets renamed.
! (push rename residue))
! ((and (assoc file-new residue)
! ;; Make sure the file really exists: if it doesn't it's
! ;; not really a conflict. It might be a temp-file generated
! ;; specifically to break a circular renaming.
! (file-exists-p file-new))
! ;; Renaming to a file name that already exists, needed to be renamed,
! ;; but whose renaming could not be performed right away.
! (if (or progress renames)
! ;; There's still a chance the conflict will be resolved.
! (push rename residue)
! ;; We have not made any progress and we've reached the end of
! ;; the renames, so we really have a circular conflict, and we
! ;; have to forcefully break the cycle.
! (message "Circular renaming: using temporary file name")
! (let ((tmp (make-temp-name file-new)))
! (push (cons (car rename) tmp) renames)
! (push (cons tmp file-new) residue))))
! (t
! (setq progress t)
! (let ((file-ori (car rename)))
! (if wdired-use-interactive-rename
! (wdired-search-and-rename file-ori file-new)
! ;; If dired-rename-file autoloads dired-aux while
! ;; dired-backup-overwrite is locally bound,
! ;; dired-backup-overwrite won't be initialized.
! ;; So we must ensure dired-aux is loaded.
! (require 'dired-aux)
! (condition-case err
! (let ((dired-backup-overwrite nil))
! (dired-rename-file file-ori file-new
! overwrite))
! (error
! (setq errors (1+ errors))
! (dired-log (concat "Rename `" file-ori "' to `"
! file-new "' failed:\n%s\n")
! err)))))))))
errors))
--- 432,485 ----
(let* ((rename (pop renames))
(file-new (cdr rename)))
(cond
! ((rassoc file-new renames)
! (error "Trying to rename 2 files to the same name"))
! ((assoc file-new renames)
! ;; Renaming to a file name that already exists but will itself be
! ;; renamed as well. Let's wait until that one gets renamed.
! (push rename residue))
! ((and (assoc file-new residue)
! ;; Make sure the file really exists: if it doesn't it's
! ;; not really a conflict. It might be a temp-file generated
! ;; specifically to break a circular renaming.
! (file-exists-p file-new))
! ;; Renaming to a file name that already exists, needed to be renamed,
! ;; but whose renaming could not be performed right away.
! (if (or progress renames)
! ;; There's still a chance the conflict will be resolved.
! (push rename residue)
! ;; We have not made any progress and we've reached the end of
! ;; the renames, so we really have a circular conflict, and we
! ;; have to forcefully break the cycle.
! (message "Circular renaming: using temporary file name")
! (let ((tmp (make-temp-name file-new)))
! (push (cons (car rename) tmp) renames)
! (push (cons tmp file-new) residue))))
! (t
! (setq progress t)
! (let* ((file-ori (car rename))
! (old-mark (cdr (assoc file-ori wdired-old-marks))))
! (if wdired-use-interactive-rename
! (wdired-search-and-rename file-ori file-new)
! ;; If dired-rename-file autoloads dired-aux while
! ;; dired-backup-overwrite is locally bound,
! ;; dired-backup-overwrite won't be initialized.
! ;; So we must ensure dired-aux is loaded.
! (require 'dired-aux)
! (condition-case err
! (let ((dired-backup-overwrite nil))
! (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)))
! (error
! (setq errors (1+ errors))
! (dired-log (concat "Rename `" file-ori "' to `"
! file-new "' failed:\n%s\n")
! err)
! (dired-add-entry file-ori old-mark)))))))))
errors))
[-- Attachment #3: Type: text/plain, Size: 11 bytes --]
Michael.
next prev parent reply other threads:[~2012-10-15 23:01 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 23:53 bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files Michael Heerdegen
2012-06-27 0:57 ` Drew Adams
2012-06-27 1:27 ` Christopher Schmidt
2012-06-27 14:20 ` Drew Adams
2012-06-27 14:47 ` Christopher Schmidt
2012-06-27 14:59 ` Drew Adams
2012-06-27 17:39 ` Michael Heerdegen
2012-06-27 18:02 ` Christopher Schmidt
2012-06-27 21:05 ` Michael Heerdegen
2012-07-04 4:02 ` Michael Heerdegen
2012-07-04 9:18 ` martin rudalics
2012-07-04 12:29 ` Stefan Monnier
2012-08-22 4:44 ` Michael Heerdegen
2012-08-22 7:08 ` martin rudalics
2012-08-29 15:19 ` Christopher Schmidt
2012-08-29 16:15 ` Michael Heerdegen
2012-08-29 17:22 ` martin rudalics
2012-10-03 9:14 ` martin rudalics
2012-10-04 23:52 ` Michael Heerdegen
2012-10-05 7:05 ` martin rudalics
2012-10-09 0:41 ` Michael Heerdegen
2012-10-15 23:01 ` Michael Heerdegen [this message]
2012-10-16 9:39 ` martin rudalics
2012-10-17 9:37 ` martin rudalics
2012-10-17 9:51 ` Christopher Schmidt
2012-10-18 9:15 ` martin rudalics
2012-10-23 8:05 ` Juri Linkov
2012-10-24 13:31 ` Michael Heerdegen
2012-10-25 9:03 ` Juri Linkov
2012-10-27 9:18 ` Juri Linkov
2012-10-27 12:55 ` Michael Heerdegen
2012-10-27 14:38 ` Juri Linkov
2012-11-22 9:12 ` Juri Linkov
2012-11-22 15:28 ` Stefan Monnier
2012-11-23 7:29 ` Juri Linkov
2012-11-23 0:04 ` Michael Heerdegen
2012-11-23 7:30 ` Juri Linkov
2012-11-25 9:12 ` Juri Linkov
2013-01-19 6:32 ` Michael Heerdegen
2013-01-19 10:37 ` Juri Linkov
2013-01-20 5:15 ` Michael Heerdegen
2020-09-21 14:58 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5j7jq5r.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=11795@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.