unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 11795@debbugs.gnu.org
Cc: Christopher Schmidt <christopher@ch.ristopher.com>
Subject: bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files
Date: Wed, 04 Jul 2012 06:02:33 +0200	[thread overview]
Message-ID: <873958b2cm.fsf@web.de> (raw)
In-Reply-To: <87d34kzcr8.fsf@web.de> (Michael Heerdegen's message of "Wed, 27 Jun 2012 23:05:47 +0200")

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

Hello again,

> The call to `dired-mark-remembered' should be wrapped in a
> `save-excursion', else it may move point to another position.

So, this is the fixed patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: wdired-finish-edit-remember-marks-fixed.diff --]
[-- Type: text/x-diff, Size: 1904 bytes --]

diff -c /home/micha/today/wdired-stuff/wdired.el /home/micha/today/wdired-stuff/wdired-orig.el
*** /home/micha/today/wdired-stuff/wdired.el	2012-07-01 04:32:46.000000000 +0200
--- /home/micha/today/wdired-stuff/wdired-orig.el	2012-07-01 04:48:03.000000000 +0200
***************
*** 351,357 ****
    (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
--- 351,356 ----
***************
*** 377,390 ****
              (setq changes t)
              (if (not file-new)		;empty filename!
                  (push file-old files-deleted)
- 	      (when dired-keep-marker-rename
- 		(let ((mark (if (integerp dired-keep-marker-rename)
- 				dired-keep-marker-rename
- 			      (cdr (assoc file-old marks)))))
- 		  (when mark
- 		    (push (cons (expand-file-name
-                                  (substitute-in-file-name file-new)) mark)
-                           marks))))
                (push (cons file-old (substitute-in-file-name file-new))
                      files-renamed))))
  	(forward-line -1)))
--- 376,381 ----
***************
*** 402,410 ****
  		     (= (length files-renamed) 1))
  	    (setq dired-directory (cdr (car files-renamed))))
  	  ;; Re-sort the buffer.
! 	  (revert-buffer)
! 	  (let ((inhibit-read-only t))
! 	    (save-excursion (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
--- 393,399 ----
  		     (= (length files-renamed) 1))
  	    (setq dired-directory (cdr (car files-renamed))))
  	  ;; Re-sort the buffer.
! 	  (revert-buffer))
        (let ((inhibit-read-only t))
  	(remove-text-properties (point-min) (point-max)
  				'(old-name nil end-name nil old-link nil

Diff finished.  Tue Jul  3 02:02:01 2012

[-- Attachment #3: Type: text/plain, Size: 131 bytes --]


I made a lot of tests, and it seems to work well now.  Please, somebody
have a look, and apply it if it's ok.


Thanks,

Michael.

  reply	other threads:[~2012-07-04  4:02 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873958b2cm.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=11795@debbugs.gnu.org \
    --cc=christopher@ch.ristopher.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).