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: Wed, 27 Jun 2012 19:39:44 +0200 Message-ID: <87zk7ozman.fsf@web.de> References: <87r4t1sk9o.fsf@web.de> <87sjdhily5@ch.ristopher.com> <06AF8E7E174A4F768ADB2B901755EA3C@us.oracle.com> <871ul0bymm@ch.ristopher.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1340818936 11489 80.91.229.3 (27 Jun 2012 17:42:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jun 2012 17:42:16 +0000 (UTC) Cc: christopher@ch.ristopher.com To: 11795@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 27 19:42:12 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 1SjwFf-00045k-Se for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 19:42:04 +0200 Original-Received: from localhost ([::1]:59877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwFf-0005zf-Ni for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 13:42:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwFY-0005zI-Mx for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:42:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjwFW-0007Uv-Ll for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:41:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwFW-0007Up-IB for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:41:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SjwJV-00059L-IS for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:46: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: Wed, 27 Jun 2012 17:46: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.134081912719733 (code B ref -1); Wed, 27 Jun 2012 17:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jun 2012 17:45:27 +0000 Original-Received: from localhost ([127.0.0.1]:60937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SjwIw-000586-Cs for submit@debbugs.gnu.org; Wed, 27 Jun 2012 13:45:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41770) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SjwIr-00057q-MC for submit@debbugs.gnu.org; Wed, 27 Jun 2012 13:45:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjwEq-00078w-3u for submit@debbugs.gnu.org; Wed, 27 Jun 2012 13:41:14 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:41207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwEq-00074h-0l for submit@debbugs.gnu.org; Wed, 27 Jun 2012 13:41:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwBY-0005I4-Eo for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:37:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjwBR-0005HQ-M7 for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:37:47 -0400 Original-Received: from mout.web.de ([212.227.17.11]:58507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjwBR-0005GS-CZ for bug-gnu-emacs@gnu.org; Wed, 27 Jun 2012 13:37:41 -0400 Original-Received: from snow.dragon ([89.204.130.168]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LkyEb-1SBhMI2K17-00aIzv; Wed, 27 Jun 2012 19:37:39 +0200 In-Reply-To: <871ul0bymm@ch.ristopher.com> (Christopher Schmidt's message of "Wed, 27 Jun 2012 15:47:18 +0100 (BST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-Provags-ID: V02:K0:Shivelyn9hH0DKKysFfaHuunLc3mEXxUchj/IyRUqBU Eh9HtRvnYggOVTmsOLylzN+2GUneCxJRLTngu7U2QYkM1BMGMx oGUDAb9p4TKZaLYUH+YK/CawL3/sRPkdtlwi5y/CAwAeouYHUd PIkrEsXgAH8XAHKn2qtKe5PW6wEUV3na8XBbvu9ght/yPr/Y0p a0qMDDZW4/6UPsA9quF4pfySK00xlNg8HnmLRDv6hQ= 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:61335 Archived-At: Hi Christopher, the patch indeed fixes the problem, thanks! But there is a problem: if I now rename a file that isn't marked, I get the following error: Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil) dired-mark-remembered((("/home/micha/Treasure/Trash/bug"))) (let ((inhibit-read-only t)) (dired-mark-remembered marks)) (progn (when (and (stringp dired-directory) (not (file-directory-p dired-= directory)) (null some-file-names-unchanged) (=3D (length files-renamed) 1)= ) (setq dired-directory (cdr (car files-renamed)))) (revert-buffer) (let ((= inhibit-read-only t)) (dired-mark-remembered marks))) (if changes (progn (when (and (stringp dired-directory) (not (file-direct= ory-p dired-directory)) (null some-file-names-unchanged) (=3D (length files= -renamed) 1)) (setq dired-directory (cdr (car files-renamed)))) (revert-buf= fer) (let ((inhibit-read-only t)) (dired-mark-remembered marks))) (let ((in= hibit-read-only t)) (remove-text-properties (point-min) (point-max) (quote = (old-name nil end-name nil old-link nil end-link nil end-perm nil old-perm = nil perm-changed nil))) (message "(No changes to be performed)"))) (let ((changes nil) (errors 0) (marks (dired-remember-marks (point-min) (= point-max))) files-deleted files-renamed some-file-names-unchanged file-old= file-new tmp-value) (save-excursion (when (and wdired-allow-to-redirect-li= nks (fboundp (quote make-symbolic-link))) (setq tmp-value (wdired-do-symlin= k-changes)) (setq errors (cdr tmp-value)) (setq changes (car tmp-value))) (= when (and wdired-allow-to-change-permissions (boundp (quote wdired-col-perm= ))) (setq tmp-value (wdired-do-perm-changes)) (setq errors (+ errors (cdr t= mp-value))) (setq changes (or changes (car tmp-value)))) (goto-char (point-= max)) (while (not (bobp)) (setq file-old (wdired-get-filename nil t)) (when= file-old (setq file-new (wdired-get-filename)) (if (equal file-new file-ol= d) (setq some-file-names-unchanged t) (setq changes t) (if (not file-new) (= push file-old files-deleted) (when dired-keep-marker-rename (push ... marks= )) (push (cons file-old ...) files-renamed)))) (forward-line -1))) (when fi= les-renamed (setq errors (+ errors (wdired-do-renames files-renamed)))) (if= changes (progn (when (and (stringp dired-directory) (not (file-directory-p= dired-directory)) (null some-file-names-unchanged) (=3D (length files-rena= med) 1)) (setq dired-directory (cdr (car files-renamed)))) (revert-buffer) = (let ((inhibit-read-only t)) (dired-mark-remembered marks))) (let ((inhibit= -read-only t)) (remove-text-properties (point-min) (point-max) (quote (old-= name nil end-name nil old-link nil end-link nil end-perm nil old-perm nil p= erm-changed nil))) (message "(No changes to be performed)"))) (when files-d= eleted (wdired-flag-for-deletion files-deleted)) (when (> errors 0) (dired-= log-summary (format "%d rename actions failed" errors) nil))) wdired-finish-edit() call-interactively(wdired-finish-edit nil nil) `dired-mark-remembered' does not accept files that are not marked, see the docstring. I guess this can easily be fixed by just removing those from the alist before calling `dired-mark-remembered'. Regards, Michael. > diff --git a/wdired.el b/wdired-fixed.el > index fe5b4ef..c5956c5 100644 > --- a/wdired.el > +++ b/wdired-fixed.el > @@ -351,6 +351,7 @@ non-nil means return old filename." > (wdired-change-to-dired-mode) > (let ((changes nil) > (errors 0) > + (marks (dired-remember-marks (point-min) (point-max))) > files-deleted > files-renamed > some-file-names-unchanged > @@ -376,6 +377,12 @@ non-nil means return old filename." > (setq changes t) > (if (not file-new) ;empty filename! > (push file-old files-deleted) > + (when dired-keep-marker-rename > + (push (cons (substitute-in-file-name file-new) > + (if (integerp dired-keep-marker-rename) > + dired-keep-marker-rename > + (cdr (assoc file-old marks)))) > + marks)) > (push (cons file-old (substitute-in-file-name file-new)) > files-renamed)))) > (forward-line -1))) > @@ -393,7 +400,9 @@ non-nil means return old filename." > (=3D (length files-renamed) 1)) > (setq dired-directory (cdr (car files-renamed)))) > ;; Re-sort the buffer. > - (revert-buffer)) > + (revert-buffer) > + (let ((inhibit-read-only t)) > + (dired-mark-remembered marks))) > (let ((inhibit-read-only t)) > (remove-text-properties (point-min) (point-max) > '(old-name nil end-name nil old-link nil > > > Christopher