From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#4880: point moves in other dired windows Date: Fri, 04 Dec 2009 23:49:28 +0200 Organization: JURTA Message-ID: <87k4x2xyd6.fsf@mail.jurta.org> References: <912155b0911060735o6f81038hcc5927f21c119700@mail.gmail.com> <87d42v8vhe.fsf@mail.jurta.org> Reply-To: Juri Linkov , 4880@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259964480 30716 80.91.229.12 (4 Dec 2009 22:08:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Dec 2009 22:08:00 +0000 (UTC) Cc: 4880@emacsbugs.donarmstrong.com, Per =?UTF-8?Q?Starb=C3=A4ck?= To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 04 23:07:52 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGgJZ-0000mv-SW for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Dec 2009 23:07:50 +0100 Original-Received: from localhost ([127.0.0.1]:51497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGgJZ-0000Su-HD for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Dec 2009 17:07:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGgJK-0000I8-9m for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 17:07:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGgJF-0000DP-BL for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 17:07:33 -0500 Original-Received: from [199.232.76.173] (port=41195 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGgJE-0000DB-VK for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 17:07:29 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:57078) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NGgJE-0001Lt-Fv for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 17:07:28 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4M7OHw032503; Fri, 4 Dec 2009 14:07:25 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nB4M04Sw031090; Fri, 4 Dec 2009 14:00:04 -0800 Resent-Date: Fri, 4 Dec 2009 14:00:04 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Juri Linkov Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 04 Dec 2009 22:00:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4880 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4880-submit@emacsbugs.donarmstrong.com id=B4880.125996344230617 (code B ref 4880); Fri, 04 Dec 2009 22:00:03 +0000 Original-Received: (at 4880) by emacsbugs.donarmstrong.com; 4 Dec 2009 21:50:42 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mx2.starman.ee (smtp-out4.starman.ee [85.253.0.6]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4LoeTu030609 for <4880@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 13:50:42 -0800 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.30.133.cable.starman.ee [82.131.30.133]) by mx2.starman.ee (Postfix) with ESMTP id 50F863F4108; Fri, 4 Dec 2009 23:50:34 +0200 (EET) In-Reply-To: <87d42v8vhe.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 04 Dec 2009 01:54:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 04 Dec 2009 17:07:33 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:33212 Archived-At: > Unfortunately, this doesn't work for dired buffers that are > not displayed in a window. This is a really annoying problem. What about the following patch that also restores buffer's point positions after dired-revert in hidden dired buffers? Index: lisp/dired.el =================================================================== RCS file: /sources/emacs/emacs/lisp/dired.el,v retrieving revision 1.446 diff -c -r1.446 dired.el *** lisp/dired.el 4 Dec 2009 05:00:44 -0000 1.446 --- lisp/dired.el 4 Dec 2009 21:49:19 -0000 *************** *** 1143,1161 **** ;; Some of these are also used when inserting subdirs. (defun dired-save-positions () ! "Return the current positions in all windows displaying this dired buffer. ! The positions have the form (WINDOW FILENAME POINT)." ! (mapcar (lambda (w) ! (list w ! (with-selected-window w ! (dired-get-filename nil t)) ! (window-point w))) ! (get-buffer-window-list nil 0 t))) (defun dired-restore-positions (positions) "Restore POSITIONS saved with `dired-save-positions'." ! (dolist (win-file-pos positions) ! (with-selected-window (car win-file-pos) (unless (and (nth 1 win-file-pos) (dired-goto-file (nth 1 win-file-pos))) (goto-char (nth 2 win-file-pos)) --- 1170,1211 ---- ;; Some of these are also used when inserting subdirs. (defun dired-save-positions () ! "Return the current positions in all buffers and windows with this directory. ! The positions have the form (BUFFER-POSITIONS WINDOW-POSITIONS). ! ! BUFFER-POSITIONS are positions in all dired buffers associated with ! the current directory. The buffer positions have the form (BUFFER ! DIRED-FILENAME BUFFER-POINT). ! ! WINDOW-POSITIONS are current positions in all windows displaying ! this dired buffer. The window positions have the form (WINDOW ! DIRED-FILENAME WINDOW-POINT)." ! (list ! (mapcar (lambda (buffer) ! (cons buffer ! (with-current-buffer buffer ! (list ! (dired-get-filename nil t) ! (point))))) ! (dired-buffers-for-dir ! (if (consp dired-directory) (car dired-directory) dired-directory))) ! (mapcar (lambda (w) ! (list w ! (with-selected-window w ! (dired-get-filename nil t)) ! (window-point w))) ! (get-buffer-window-list nil 0 t)))) (defun dired-restore-positions (positions) "Restore POSITIONS saved with `dired-save-positions'." ! (dolist (buf-file-pos (nth 0 positions)) ! (with-current-buffer (nth 0 buf-file-pos) ! (unless (and (nth 1 buf-file-pos) ! (dired-goto-file (nth 1 buf-file-pos))) ! (goto-char (nth 2 buf-file-pos)) ! (dired-move-to-filename)))) ! (dolist (win-file-pos (nth 1 positions)) ! (with-selected-window (nth 0 win-file-pos) (unless (and (nth 1 win-file-pos) (dired-goto-file (nth 1 win-file-pos))) (goto-char (nth 2 win-file-pos)) -- Juri Linkov http://www.jurta.org/emacs/