changeset 23248:6119bb0ddd69

(scroll-bar-scroll-down, scroll-bar-scroll-up): Set point-before-scroll at end even if there was an error.
author Karl Heuer <kwzh@gnu.org>
date Sun, 13 Sep 1998 03:51:22 +0000
parents 1f91824c4087
children 2df8a4a5e284
files lisp/scroll-bar.el
diffstat 1 files changed, 22 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/scroll-bar.el	Sun Sep 13 03:45:02 1998 +0000
+++ b/lisp/scroll-bar.el	Sun Sep 13 03:51:22 1998 +0000
@@ -250,16 +250,17 @@
 	 (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 @@
 	 (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.