summaryrefslogtreecommitdiff
path: root/lisp/scroll-bar.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-09-13 03:51:22 +0000
committerKarl Heuer <kwzh@gnu.org>1998-09-13 03:51:22 +0000
commitdef7db1da1e0fa89f4c4da31d5fbf1616a76ec92 (patch)
treef57a7372714766180054a3cf555ec69b4228ca3e /lisp/scroll-bar.el
parent7ff020486d03859e1608a479cbad72a039a75489 (diff)
downloademacs-def7db1da1e0fa89f4c4da31d5fbf1616a76ec92.tar.gz
(scroll-bar-scroll-down, scroll-bar-scroll-up):
Set point-before-scroll at end even if there was an error.
Diffstat (limited to 'lisp/scroll-bar.el')
-rw-r--r--lisp/scroll-bar.el42
1 files changed, 22 insertions, 20 deletions
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 5458ab0054f..d8e21921458 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -250,16 +250,17 @@ EVENT should be a scroll bar click."
(before-scroll))
(with-current-buffer (window-buffer window)
(setq before-scroll point-before-scroll))
- (save-selected-window
- (let ((portion-whole (nth 2 end-position)))
- (select-window window)
- (setq before-scroll
- (or before-scroll (point)))
- (scroll-down
- (scroll-bar-scale portion-whole (1- (window-height))))))
- (sit-for 0)
- (with-current-buffer (window-buffer window)
- (setq point-before-scroll before-scroll))))
+ (unwind-protect
+ (save-selected-window
+ (let ((portion-whole (nth 2 end-position)))
+ (select-window window)
+ (setq before-scroll
+ (or before-scroll (point)))
+ (scroll-down
+ (scroll-bar-scale portion-whole (1- (window-height)))))
+ (sit-for 0))
+ (with-current-buffer (window-buffer window)
+ (setq point-before-scroll before-scroll)))))
(defun scroll-bar-scroll-up (event)
"Scroll the line next to the scroll bar click to the top of the window.
@@ -270,16 +271,17 @@ EVENT should be a scroll bar click."
(before-scroll))
(with-current-buffer (window-buffer window)
(setq before-scroll point-before-scroll))
- (save-selected-window
- (let ((portion-whole (nth 2 end-position)))
- (select-window window)
- (setq before-scroll
- (or before-scroll (point)))
- (scroll-up
- (scroll-bar-scale portion-whole (1- (window-height))))))
- (sit-for 0)
- (with-current-buffer (window-buffer window)
- (setq point-before-scroll before-scroll))))
+ (unwind-protect
+ (save-selected-window
+ (let ((portion-whole (nth 2 end-position)))
+ (select-window window)
+ (setq before-scroll
+ (or before-scroll (point)))
+ (scroll-up
+ (scroll-bar-scale portion-whole (1- (window-height)))))
+ (sit-for 0))
+ (with-current-buffer (window-buffer window)
+ (setq point-before-scroll before-scroll)))))
;;;; Bindings.