| 146 | | center of the window." |
|---|
| 147 | | (save-excursion |
|---|
| 148 | | (goto-char (window-start)) |
|---|
| 149 | | (vertical-motion line) |
|---|
| 150 | | (set-window-start (selected-window) (point)))) |
|---|
| | 146 | center of the window. |
|---|
| | 147 | If WINDOW is nil, scroll current window." |
|---|
| | 148 | (save-selected-window |
|---|
| | 149 | (if window (select-window window)) |
|---|
| | 150 | (let ((opos (point))) |
|---|
| | 151 | (goto-char (window-start)) |
|---|
| | 152 | (vertical-motion line) |
|---|
| | 153 | (set-window-start (selected-window) (point)) |
|---|
| | 154 | (goto-char opos) |
|---|
| | 155 | |
|---|
| | 156 | ;; If the point is on the line not fully displayed, move point |
|---|
| | 157 | ;; out of wnidow to avoid unintentional scrolling on |
|---|
| | 158 | ;; redrawing. |
|---|
| | 159 | (if (let ((partial (pos-visible-in-window-p opos nil t))) |
|---|
| | 160 | (and partial (nth 2 partial))) |
|---|
| | 161 | (vertical-motion 1))))) |
|---|
| 186 | | (let ((old-window (selected-window))) |
|---|
| 187 | | (unwind-protect |
|---|
| 188 | | (let* ((position (event-start event)) |
|---|
| 189 | | (window (nth 0 position)) |
|---|
| 190 | | (lines |
|---|
| 191 | | (w32-get-mouse-wheel-scroll-lines |
|---|
| 192 | | (nth 4 position))) |
|---|
| 193 | | (window-scroll-step (- (window-height window) |
|---|
| 194 | | next-screen-context-lines))) |
|---|
| 195 | | (if (not lines) |
|---|
| 196 | | (if (< (nth 4 position) 0) |
|---|
| 197 | | (setq lines 3) |
|---|
| 198 | | (setq lines -3))) |
|---|
| 199 | | (if (<= window-scroll-step 0) |
|---|
| 200 | | (setq window-scroll-step (window-height window))) |
|---|
| 201 | | (cond |
|---|
| 202 | | ((eq lines 'above-handle) |
|---|
| 203 | | (setq lines (- window-scroll-step))) |
|---|
| 204 | | ((eq lines 'below-handle) |
|---|
| 205 | | (setq lines window-scroll-step))) |
|---|
| 206 | | (if (windowp window) |
|---|
| 207 | | (progn |
|---|
| 208 | | (select-window window) |
|---|
| 209 | | (scroll-but-point lines)))) |
|---|
| 210 | | (select-window old-window)))) |
|---|
| | 197 | (unwind-protect |
|---|
| | 198 | (let* ((position (event-start event)) |
|---|
| | 199 | (window (nth 0 position)) |
|---|
| | 200 | (lines |
|---|
| | 201 | (w32-get-mouse-wheel-scroll-lines |
|---|
| | 202 | (nth 4 position))) |
|---|
| | 203 | (window-scroll-step (- (window-height window) |
|---|
| | 204 | next-screen-context-lines))) |
|---|
| | 205 | (if (not lines) |
|---|
| | 206 | (if (< (nth 4 position) 0) |
|---|
| | 207 | (setq lines 3) |
|---|
| | 208 | (setq lines -3))) |
|---|
| | 209 | (if (<= window-scroll-step 0) |
|---|
| | 210 | (setq window-scroll-step (window-height window))) |
|---|
| | 211 | (cond |
|---|
| | 212 | ((eq lines 'above-handle) |
|---|
| | 213 | (setq lines (- window-scroll-step))) |
|---|
| | 214 | ((eq lines 'below-handle) |
|---|
| | 215 | (setq lines window-scroll-step))) |
|---|
| | 216 | (if (windowp window) |
|---|
| | 217 | (scroll-but-point lines window))))) |
|---|