From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs 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 Message-ID: <87y5j7jq5r.fsf@web.de> References: <87r4t1sk9o.fsf@web.de> <87sjdhily5@ch.ristopher.com> <06AF8E7E174A4F768ADB2B901755EA3C@us.oracle.com> <871ul0bymm@ch.ristopher.com> <87zk7ozman.fsf@web.de> <87d34kfxa3@ch.ristopher.com> <87d34kzcr8.fsf@web.de> <873958b2cm.fsf@web.de> <4FF40A79.5000707@gmx.at> <87ipcbmt6d.fsf@web.de> <50348571.1070605@gmx.at> <87bohtlo9d@ch.ristopher.com> <87a9xdoet6.fsf@web.de> <506C01ED.9000906@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1350342127 3580 80.91.229.3 (15 Oct 2012 23:02:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Oct 2012 23:02:07 +0000 (UTC) To: 11795@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 16 01:02:14 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 1TNtfj-0007Tw-S8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Oct 2012 01:02:08 +0200 Original-Received: from localhost ([::1]:50802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtfd-0004hM-2Z for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 Oct 2012 19:02:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtfW-0004gs-BU for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNtfU-0003Ok-UB for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtfU-0003Of-QY for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TNtgb-0005Rs-Rn for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Oct 2012 23:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11795 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135034216720922 (code B ref -1); Mon, 15 Oct 2012 23:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Oct 2012 23:02:47 +0000 Original-Received: from localhost ([127.0.0.1]:45849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TNtgM-0005RP-Io for submit@debbugs.gnu.org; Mon, 15 Oct 2012 19:02:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56552) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TNtgK-0005RC-FS for submit@debbugs.gnu.org; Mon, 15 Oct 2012 19:02:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNtf6-0003Fd-5q for submit@debbugs.gnu.org; Mon, 15 Oct 2012 19:01:29 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:60131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtf6-0003FW-0Y for submit@debbugs.gnu.org; Mon, 15 Oct 2012 19:01:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtf4-0004WT-S1 for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNtf3-0003Ek-Gx for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:26 -0400 Original-Received: from mout.web.de ([212.227.15.4]:64022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNtf3-0003EZ-6q for bug-gnu-emacs@gnu.org; Mon, 15 Oct 2012 19:01:25 -0400 Original-Received: from drachen.dragon ([89.204.139.251]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MGiUP-1TAzNC1Ajh-00DTI4; Tue, 16 Oct 2012 01:01:24 +0200 In-Reply-To: <506C01ED.9000906@gmx.at> (martin rudalics's message of "Wed, 03 Oct 2012 11:14:21 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Provags-ID: V02:K0:njv8TXt71ClixLR48P2DsG6Ta2KazvPd8CAhTfxcRNV HCn7JBdoQRksw6aXlcA6quBw0aiao+sy0ZhT5U2o6Zjl/B+McU pJjk2mADMINziDN7/KJcgEyI/M1YwMpc2avarqRG/HWNses3zG Tx9IY9LwFy2BjqVbMI3lejvkETrbLZbNBlWRpGwZJ993F9S4om DggIrj4Vgto7jRR/vizic1p85zXfeYS5t6UTg+g5ZU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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 (newer, 2) 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:65650 Archived-At: --=-=-= Content-Type: text/plain martin rudalics 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=wdired.patch *** /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)) --=-=-= Content-Type: text/plain Michael. --=-=-=--