[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4880: point moves in other dired windows
From: |
Juri Linkov |
Subject: |
bug#4880: point moves in other dired windows |
Date: |
Fri, 04 Dec 2009 23:49:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) |
> 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/
- bug#4880: point moves in other dired windows,
Juri Linkov <=