From: storm@cua.dk (Kim F. Storm)
Subject: Simplification to mouse-avoidance-mode (patch) + redisplay bug?
Date: Tue, 02 May 2006 14:23:18 +0200 [thread overview]
Message-ID: <m3fyjsbop5.fsf@kfs-l.imdomain.dk> (raw)
Using posn-at-point seems to be much simpler than compute-motion:
Index: avoid.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/avoid.el,v
retrieving revision 1.40
diff -c -r1.40 avoid.el
*** avoid.el 6 Feb 2006 14:33:32 -0000 1.40
--- avoid.el 2 May 2006 12:19:57 -0000
***************
*** 139,161 ****
(defun mouse-avoidance-point-position ()
"Return the position of point as (FRAME X . Y).
Analogous to `mouse-position'."
! (let* ((w (selected-window))
! (edges (window-inside-edges w))
! (list
! (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
! nil ; stop XY: none
! nil ; width
! (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)
(cons (selected-frame)
! (cons (+ (car edges) (car (cdr list)))
! (+ (car (cdr edges)) (car (cdr (cdr list))))))))
;(defun mouse-avoidance-point-position-test ()
; (interactive)
--- 139,151 ----
(defun mouse-avoidance-point-position ()
"Return the position of point as (FRAME X . Y).
Analogous to `mouse-position'."
! (let ((edges (window-inside-edges))
! (x-y (posn-x-y (posn-at-point))))
(cons (selected-frame)
! (cons (+ (car edges)
! (/ (car x-y) (frame-char-width)))
! (+ (car (cdr edges))
! (/ (cdr x-y) (frame-char-height)))))))
;(defun mouse-avoidance-point-position-test ()
; (interactive)
I notice that the final cursor shape often gets it wrong if I set the
style to "cat-and-mouse", it seems to happen if the cursor passes over
an area (eg. void or a mode line) along the chosen path. That looks
like a redisplay bug.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next reply other threads:[~2006-05-02 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 12:23 Kim F. Storm [this message]
2006-05-02 21:37 ` Simplification to mouse-avoidance-mode (patch) + redisplay bug? Richard Stallman
2006-05-10 14:01 ` Kim F. Storm
2006-05-11 3:46 ` Richard Stallman
2006-05-11 7:50 ` Jan Djärv
2006-05-11 10:03 ` Kim F. Storm
2006-05-12 7:07 ` Jan Djärv
2006-05-14 0:12 ` Kim F. Storm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3fyjsbop5.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.