aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2006-02-28 21:51:39 +0000
committerNick Roberts2006-02-28 21:51:39 +0000
commit40e9b5d0aa8868a0d30dc8f30f63b384b0e695e1 (patch)
treeaadb1032ad8c48a80a245fedd51bc0bbd101593a
parenta9e22173e4c6e696f394465db7c7bbb8058d2cfa (diff)
downloademacs-40e9b5d0aa8868a0d30dc8f30f63b384b0e695e1.tar.gz
emacs-40e9b5d0aa8868a0d30dc8f30f63b384b0e695e1.zip
(speedbar-update-localized-contents): Try to
preserve window-start. (speedbar-update-directory-contents): Try to preserve window-start and window-point. (speedbar-update-special-contents): Don't move back to start of window.
-rw-r--r--lisp/speedbar.el38
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 6a9ecbc542d..2e55c4929d5 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -2534,20 +2534,19 @@ name will have the function FIND-FUN and not token."
2534 (set-buffer speedbar-buffer) 2534 (set-buffer speedbar-buffer)
2535 (speedbar-with-writable 2535 (speedbar-with-writable
2536 (let* ((window (get-buffer-window speedbar-buffer 0)) 2536 (let* ((window (get-buffer-window speedbar-buffer 0))
2537 (p (window-point window))) 2537 (p (window-point window))
2538 (start (window-start window)))
2538 (erase-buffer) 2539 (erase-buffer)
2539 (dolist (func funclst) 2540 (dolist (func funclst)
2540 (setq default-directory cbd) 2541 (setq default-directory cbd)
2541 (funcall func cbd 0)) 2542 (funcall func cbd 0))
2542 (speedbar-reconfigure-keymaps) 2543 (speedbar-reconfigure-keymaps)
2543 (set-window-point window p))) 2544 (set-window-point window p)
2545 (set-window-start window start)))
2544 )))) 2546 ))))
2545 2547
2546(defun speedbar-update-directory-contents () 2548(defun speedbar-update-directory-contents ()
2547 "Update the contents of the speedbar buffer based on the current directory." 2549 "Update the contents of the speedbar buffer based on the current directory."
2548
2549 (save-excursion
2550
2551 (let ((cbd (expand-file-name default-directory)) 2550 (let ((cbd (expand-file-name default-directory))
2552 cbd-parent 2551 cbd-parent
2553 (funclst (speedbar-initial-expansion-list)) 2552 (funclst (speedbar-initial-expansion-list))
@@ -2608,17 +2607,21 @@ name will have the function FIND-FUN and not token."
2608 (speedbar-directory-line cbd)) 2607 (speedbar-directory-line cbd))
2609 ;; Open it. 2608 ;; Open it.
2610 (speedbar-expand-line) 2609 (speedbar-expand-line)
2611 (erase-buffer) 2610 (let* ((window (get-buffer-window speedbar-buffer 0))
2612 (cond (use-cache 2611 (p (window-point window))
2613 (setq default-directory 2612 (start (window-start window)))
2614 (nth (1- (length speedbar-shown-directories)) 2613 (erase-buffer)
2615 speedbar-shown-directories)) 2614 (cond (use-cache
2616 (insert (cdr cache))) 2615 (setq default-directory
2617 (t 2616 (nth (1- (length speedbar-shown-directories))
2618 (dolist (func funclst) 2617 speedbar-shown-directories))
2619 (setq default-directory cbd) 2618 (insert (cdr cache)))
2620 (funcall func cbd 0))))) 2619 (t
2621 (goto-char (point-min))))) 2620 (dolist (func funclst)
2621 (setq default-directory cbd)
2622 (funcall func cbd 0))))
2623 (set-window-point window p)
2624 (set-window-start window start)))))
2622 (speedbar-reconfigure-keymaps)) 2625 (speedbar-reconfigure-keymaps))
2623 2626
2624(defun speedbar-update-special-contents () 2627(defun speedbar-update-special-contents ()
@@ -2643,8 +2646,7 @@ This should only be used by modes classified as special."
2643 (dolist (func funclst) 2646 (dolist (func funclst)
2644 ;; We do not erase the buffer because these functions may 2647 ;; We do not erase the buffer because these functions may
2645 ;; decide NOT to update themselves. 2648 ;; decide NOT to update themselves.
2646 (funcall func specialbuff))) 2649 (funcall func specialbuff)))))
2647 (goto-char (point-min))))
2648 (speedbar-reconfigure-keymaps)) 2650 (speedbar-reconfigure-keymaps))
2649 2651
2650(defun speedbar-set-timer (timeout) 2652(defun speedbar-set-timer (timeout)