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: Sat, 27 Oct 2012 14:55:40 +0200 Message-ID: <87pq44rs4z.fsf@web.de> References: <87r4t1sk9o.fsf@web.de> <87sjdhily5@ch.ristopher.com> <06AF8E7E174A4F768ADB2B901755EA3C@us.oracle.com> <87sj95ad3l.fsf@mail.jurta.org> <87vce0xah6.fsf@web.de> <87a9v85l3p.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1351342553 30314 80.91.229.3 (27 Oct 2012 12:55:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2012 12:55:53 +0000 (UTC) Cc: 11795@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 27 14:56:01 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 1TS5vk-0005vV-Ob for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Oct 2012 14:56:00 +0200 Original-Received: from localhost ([::1]:60781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS5vc-0001zj-Px for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Oct 2012 08:55:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS5vZ-0001tM-Nc for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2012 08:55:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TS5vY-0007vs-Nm for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2012 08:55:49 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TS5vY-0007vo-IV for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2012 08:55:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TS5xi-0004Iy-83 for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2012 08:58:02 -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: Sat, 27 Oct 2012 12:58:02 +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: Original-Received: via spool by 11795-submit@debbugs.gnu.org id=B11795.135134266216521 (code B ref 11795); Sat, 27 Oct 2012 12:58:02 +0000 Original-Received: (at 11795) by debbugs.gnu.org; 27 Oct 2012 12:57:42 +0000 Original-Received: from localhost ([127.0.0.1]:35534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TS5xN-0004IQ-3i for submit@debbugs.gnu.org; Sat, 27 Oct 2012 08:57:41 -0400 Original-Received: from mout.web.de ([212.227.15.4]:63138) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TS5xI-0004ID-4G for 11795@debbugs.gnu.org; Sat, 27 Oct 2012 08:57:37 -0400 Original-Received: from drachen.dragon ([82.113.121.141]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LpwMZ-1SxQC80yqF-00fWXl; Sat, 27 Oct 2012 14:55:20 +0200 In-Reply-To: <87a9v85l3p.fsf@mail.jurta.org> (Juri Linkov's message of "Sat, 27 Oct 2012 12:18:34 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Provags-ID: V02:K0:QF1jYeRRfkSNPi0z+lV8nNJCyYdDy90qqxQf8EOF6T9 +kIumNYrGM/2L40miNF3M1pIgAnOWivAKqgumJ/NYaOh/fM5IL X3M/uK4hNJtTo9wrIOP024uZkWNv8ZSdhz9izs7tnAN2lUIkb7 jZAkAfcrHk+6ule0xntDYbEUnNnDvfyKvFsxKsJc7Fg1IlqdaG JPGXGwyaDgntvrFrfsa1igMsikdyyj93wjEGVayXCA= 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:66106 Archived-At: Hello Juri, > > So, introducing an new option `wdired-keep-marker-rename' would IMHO make > > sense. The default value could be t, at least that's what I think would > > be most intuitive. > > I fixed this regression by adding `wdired-keep-marker-rename'. > Thanks for the suggestion. Good - thanks! > When testing it, I noticed a random behavior of `wdired-do-renames' > when the marker is customized to a character. The decision what > character to put depends on the position of point. When point is at > the top of the Dired buffer, it uses a customized marker character. > When point is at the bottom, it restores an old marker character. > > The problem is that `dired-remove-file' doesn't remove file entries > (and neither `dired-rename-file') because files already have new > renamed names > in the Dired buffer. Whereas `dired-add-entry' adds duplicated file > entries. > > Fortunately, `revert-buffer' (called at the end of > `wdired-finish-edit') sorts out this mess caused by `dired-add-entry'. > But in `dired-revert' it uses `dired-remember-marks' and > `dired-restore-positions' to restore markers. So when duplicated file > entries were added by `dired-add-entry' at the top of the Dired buffer > (in front of file entries edited by WDired), it uses a customized > marker character. When duplicated file entries were added at the > bottom, it restores an old marker character because > `dired-restore-positions' in `dired-revert' gets markers from the > first duplicated file entry. Thanks for finding this, and for your analysis. > Do you have an idea how to fix this problem? One way would be instead > of using `dired-add-file' to change markers in the remembered variable > `wdired-old-marks' and just call `dired-mark-remembered' (before > `revert-buffer' in `wdired-finish-edit') with the modified list of > markers for renamed files. I chose to use `dired-add-file' in my patch so that name changes are propagated also to other dired buffers where these files may also be shown. This is consistent with `dired-do-rename'. WRT your suggestion: I see two problems: 1. Calling `dired-mark-remembered' before `revert-buffer' is not reliable, because it may fail to get the right names from places where changes were made. I.e., it my not work for the same reason as `dired-remove-file' doesn't work. 2. Even if this worked well, the remaining old lines of renamed files are still lying around. They can still cause trouble. When `revert-buffer' is called, these lines are still included for remembering marks. This is problematic: there is a chance that the user has renamed another file in that buffer to that collected name. My suggestion would be to just delete the according lines so that they cannot cause trouble, simply with `delete-region'. That should not do any harm. What do you think? Regards, Michael.