From: Jan Djärv Date: Sun, 28 Feb 2010 14:36:34 +0000 (+0100) Subject: scroll-bar.el (scroll-bar-drag-1): Add save-excursion, bug #5654. X-Git-Tag: emacs-pretest-23.1.94~25^2~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=71572c0330cd8ba69e47bacab1f0764878702233;p=emacs.git scroll-bar.el (scroll-bar-drag-1): Add save-excursion, bug #5654. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 329139951a9..0a8105a7aeb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-02-28 Jan Djärv + + * scroll-bar.el (scroll-bar-drag-1): Add save-excursion, bug #5654. + 2010-02-28 Michael Albinus * net/tramp.el (tramp-handle-write-region): START can be a string. diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index c28a417a8f3..3f763fc59da 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -210,13 +210,14 @@ EVENT should be a scroll bar click or drag event." (let* ((start-position (event-start event)) (window (nth 0 start-position)) (portion-whole (nth 2 start-position))) - (with-current-buffer (window-buffer window) - ;; Calculate position relative to the accessible part of the buffer. - (goto-char (+ (point-min) - (scroll-bar-scale portion-whole - (- (point-max) (point-min))))) - (vertical-motion 0 window) - (set-window-start window (point))))) + (save-excursion + (with-current-buffer (window-buffer window) + ;; Calculate position relative to the accessible part of the buffer. + (goto-char (+ (point-min) + (scroll-bar-scale portion-whole + (- (point-max) (point-min))))) + (vertical-motion 0 window) + (set-window-start window (point)))))) (defun scroll-bar-drag (event) "Scroll the window by dragging the scroll bar slider.