summaryrefslogtreecommitdiff
path: root/lisp/avoid.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-06-11 12:14:28 +0000
committerRichard M. Stallman <rms@gnu.org>1994-06-11 12:14:28 +0000
commit96ae4787ad323fbbcb55582376c95c743e7a6dd8 (patch)
treed38e2a739d6afae7d5a037376b795daa0f27a7f7 /lisp/avoid.el
parent2e7d3af41c8d36ae24662f29a3120e8a3b61a4a9 (diff)
downloademacs-96ae4787ad323fbbcb55582376c95c743e7a6dd8.tar.gz
emacs-96ae4787ad323fbbcb55582376c95c743e7a6dd8.tar.bz2
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.
Diffstat (limited to 'lisp/avoid.el')
-rw-r--r--lisp/avoid.el22
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."
(let* ((w (selected-window))
(edges (window-edges w))
(list
- (compute-motion (window-start w) ; start pos
- (cons (car edges) (car (cdr edges))) ; start XY
+ (compute-motion (max (window-start w) (point-min)) ; start pos
+ ;; window-start can be < point-min if the
+ ;; latter has changed since the last redisplay
+ '(0 . 0) ; start XY
(point) ; stop pos
- (cons (nth 2 edges) (nth 3 edges)) ; stop XY: none
+ (cons (window-width) (window-height)); stop XY: none
(1- (window-width)) ; width
- (cons (window-hscroll w) 0) ; 0 may not be right?
+ (cons (window-hscroll w) 0) ; 0 may not be right?
(selected-window))))
;; compute-motion returns (pos HPOS VPOS prevhpos contin)
;; we want: (frame hpos . vpos)
- (setcar list (selected-frame))
- (setcdr (cdr list) (car (cdr (cdr list))))
- list))
+ (cons (selected-frame)
+ (cons (+ (car edges) (car (cdr list)))
+ (+ (car (cdr edges)) (car (cdr (cdr list))))))))
+
+;(defun mouse-avoidance-point-position-test ()
+; (interactive)
+; (message (format "point=%s mouse=%s"
+; (cdr (mouse-avoidance-point-position))
+; (cdr (mouse-position)))))
(defun mouse-avoidance-set-mouse-position (pos)
;; Carefully set mouse position to given position (X . Y)