diff options
| author | Richard M. Stallman | 1994-06-11 12:14:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-06-11 12:14:28 +0000 |
| commit | 96ae4787ad323fbbcb55582376c95c743e7a6dd8 (patch) | |
| tree | d38e2a739d6afae7d5a037376b795daa0f27a7f7 | |
| parent | 2e7d3af41c8d36ae24662f29a3120e8a3b61a4a9 (diff) | |
| download | emacs-96ae4787ad323fbbcb55582376c95c743e7a6dd8.tar.gz emacs-96ae4787ad323fbbcb55582376c95c743e7a6dd8.zip | |
(mouse-avoidance-point-position): Fix compute-motion
call to use (X . Y) relative to window, not frame.
Avoid errors if window-start < point-min.
| -rw-r--r-- | lisp/avoid.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/avoid.el b/lisp/avoid.el index 376baf7c52a..214e5bb2757 100644 --- a/lisp/avoid.el +++ b/lisp/avoid.el | |||
| @@ -109,18 +109,26 @@ Analogous to mouse-position." | |||
| 109 | (let* ((w (selected-window)) | 109 | (let* ((w (selected-window)) |
| 110 | (edges (window-edges w)) | 110 | (edges (window-edges w)) |
| 111 | (list | 111 | (list |
| 112 | (compute-motion (window-start w) ; start pos | 112 | (compute-motion (max (window-start w) (point-min)) ; start pos |
| 113 | (cons (car edges) (car (cdr edges))) ; start XY | 113 | ;; window-start can be < point-min if the |
| 114 | ;; latter has changed since the last redisplay | ||
| 115 | '(0 . 0) ; start XY | ||
| 114 | (point) ; stop pos | 116 | (point) ; stop pos |
| 115 | (cons (nth 2 edges) (nth 3 edges)) ; stop XY: none | 117 | (cons (window-width) (window-height)); stop XY: none |
| 116 | (1- (window-width)) ; width | 118 | (1- (window-width)) ; width |
| 117 | (cons (window-hscroll w) 0) ; 0 may not be right? | 119 | (cons (window-hscroll w) 0) ; 0 may not be right? |
| 118 | (selected-window)))) | 120 | (selected-window)))) |
| 119 | ;; compute-motion returns (pos HPOS VPOS prevhpos contin) | 121 | ;; compute-motion returns (pos HPOS VPOS prevhpos contin) |
| 120 | ;; we want: (frame hpos . vpos) | 122 | ;; we want: (frame hpos . vpos) |
| 121 | (setcar list (selected-frame)) | 123 | (cons (selected-frame) |
| 122 | (setcdr (cdr list) (car (cdr (cdr list)))) | 124 | (cons (+ (car edges) (car (cdr list))) |
| 123 | list)) | 125 | (+ (car (cdr edges)) (car (cdr (cdr list)))))))) |
| 126 | |||
| 127 | ;(defun mouse-avoidance-point-position-test () | ||
| 128 | ; (interactive) | ||
| 129 | ; (message (format "point=%s mouse=%s" | ||
| 130 | ; (cdr (mouse-avoidance-point-position)) | ||
| 131 | ; (cdr (mouse-position))))) | ||
| 124 | 132 | ||
| 125 | (defun mouse-avoidance-set-mouse-position (pos) | 133 | (defun mouse-avoidance-set-mouse-position (pos) |
| 126 | ;; Carefully set mouse position to given position (X . Y) | 134 | ;; Carefully set mouse position to given position (X . Y) |