unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 4880@emacsbugs.donarmstrong.com, "Per Starbäck" <per@starback.se>
Subject: bug#4880: point moves in other dired windows
Date: Sat, 05 Dec 2009 21:42:16 +0200	[thread overview]
Message-ID: <87vdglctrb.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvfx7qj9te.fsf-monnier+emacsbugreports@gnu.org> (Stefan Monnier's message of "Sat, 05 Dec 2009 00:00:47 -0500")

> I do not understand, why we save the point of all
> "dired-buffers-for-dir" but only the point of the windows showing the
> current buffer.
> I'd prefer to resolve this discrepancy by only saving the current
> buffer's point (after all, the other buffer's won't be affected by the
> revert, right)?

Since other buffers of the same dir won't be reverted, then yes,
there is no point in saving their points.

Index: lisp/dired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired.el,v
retrieving revision 1.447
diff -c -r1.447 dired.el
*** lisp/dired.el	4 Dec 2009 21:45:34 -0000	1.447
--- lisp/dired.el	5 Dec 2009 19:39:39 -0000
***************
*** 1169,1187 ****
  ;; 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))
--- 1169,1201 ----
  ;; Some of these are also used when inserting subdirs.
  
  (defun dired-save-positions ()
!   "Return current positions in the buffer and all windows with this directory.
! The positions have the form (BUFFER-POSITION WINDOW-POSITIONS).
! 
! BUFFER-POSITION is the point position in the current dired buffer.
! The buffer position have the form (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
!    (list (dired-get-filename nil t) (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'."
!   (let ((buf-file-pos (nth 0 positions)))
!     (unless (and (nth 0 buf-file-pos)
! 		 (dired-goto-file (nth 0 buf-file-pos)))
!       (goto-char (nth 1 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/





  reply	other threads:[~2009-12-05 19:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwv639fs71y.fsf-monnier+emacsbugreports@gnu.org>
2009-11-06 15:35 ` bug#4880: point moves in other dired windows Per Starbäck
2009-11-12 22:45   ` bug#4880: marked as done (point moves in other dired windows) Emacs bug Tracking System
     [not found] ` <87d42v8vhe.fsf@mail.jurta.org>
2009-12-04 21:49   ` bug#4880: point moves in other dired windows Juri Linkov
2009-12-05  5:00     ` Stefan Monnier
2009-12-05 19:42       ` Juri Linkov [this message]
2009-12-05 21:09         ` Stefan Monnier
2009-12-05 23:22           ` Juri Linkov

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=87vdglctrb.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=4880@emacsbugs.donarmstrong.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=per@starback.se \
    /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).