From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11795: 24.1.50; wdired: C-c C-c loses marks and positions of renamed files Date: Wed, 04 Jul 2012 08:29:57 -0400 Message-ID: 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1341405036 6916 80.91.229.3 (4 Jul 2012 12:30:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 4 Jul 2012 12:30:36 +0000 (UTC) Cc: Michael Heerdegen , Christopher Schmidt , 11795@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 04 14:30:35 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 1SmOj3-0008Bc-4a for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Jul 2012 14:30:33 +0200 Original-Received: from localhost ([::1]:40850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmOj1-00039z-PU for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Jul 2012 08:30:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmOiw-00037W-2H for bug-gnu-emacs@gnu.org; Wed, 04 Jul 2012 08:30:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmOim-0000Lf-Bn for bug-gnu-emacs@gnu.org; Wed, 04 Jul 2012 08:30:25 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmOim-0000Lb-8N for bug-gnu-emacs@gnu.org; Wed, 04 Jul 2012 08:30:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SmOnO-0002C0-HN for bug-gnu-emacs@gnu.org; Wed, 04 Jul 2012 08:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jul 2012 12:35: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.13414052878405 (code B ref 11795); Wed, 04 Jul 2012 12:35:02 +0000 Original-Received: (at 11795) by debbugs.gnu.org; 4 Jul 2012 12:34:47 +0000 Original-Received: from localhost ([127.0.0.1]:47410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmOn9-0002BW-1c for submit@debbugs.gnu.org; Wed, 04 Jul 2012 08:34:47 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:62192) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmOn8-0002BQ-7R for 11795@debbugs.gnu.org; Wed, 04 Jul 2012 08:34:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ak8QAG6Zu09MCquH/2dsb2JhbABEgieuIYNJgQiCFQEBBAFWIxALNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="192639918" Original-Received: from 76-10-171-135.dsl.teksavvy.com (HELO pastel.home) ([76.10.171.135]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 Jul 2012 08:29:58 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 3D51258FD2; Wed, 4 Jul 2012 08:29:57 -0400 (EDT) In-Reply-To: <4FF40A79.5000707@gmx.at> (martin rudalics's message of "Wed, 04 Jul 2012 11:18:49 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) 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:61566 Archived-At: >>> The call to `dired-mark-remembered' should be wrapped in a >>> `save-excursion', else it may move point to another position. > Can someone explain why `dired-mark-remembered' cannot do: > (defun dired-mark-remembered (alist) > "Mark all files remembered in ALIST. > Each element of ALIST looks like (FILE . MARKERCHAR)." > (let (elt fil chr) > (save-excursion > (while alist > (setq elt (car alist) > alist (cdr alist) > fil (car elt) > chr (cdr elt)) > (when (dired-goto-file fil) > (beginning-of-line) > (delete-char 1) > (insert chr)))))) I have no idea, but you could rewrite the above as: (require 'pcase) (defun dired-mark-remembered (alist) "Mark all files remembered in ALIST. Each element of ALIST looks like (FILE . MARKERCHAR)." (save-excursion (pcase-dolist (`(,fil . ,chr) alist) (when (dired-goto-file fil) (beginning-of-line) (delete-char 1) (insert chr))))) -- Stefan "official pcase promoter"