From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Simplification to mouse-avoidance-mode (patch) + redisplay bug? Date: Tue, 02 May 2006 14:23:18 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1146572757 27675 80.91.229.2 (2 May 2006 12:25:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 May 2006 12:25:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 02 14:25:53 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FatwY-0002Co-9Y for ged-emacs-devel@m.gmane.org; Tue, 02 May 2006 14:25:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FatwX-0006K8-MN for ged-emacs-devel@m.gmane.org; Tue, 02 May 2006 08:25:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FatwE-0006E8-1e for emacs-devel@gnu.org; Tue, 02 May 2006 08:25:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fatw9-000687-QC for emacs-devel@gnu.org; Tue, 02 May 2006 08:25:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fatw9-00067H-9G for emacs-devel@gnu.org; Tue, 02 May 2006 08:25:05 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FatwI-00044Q-K9 for emacs-devel@gnu.org; Tue, 02 May 2006 08:25:14 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id B0961262855 for ; Tue, 2 May 2006 14:25:03 +0200 (CEST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53786 Archived-At: 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 http://www.cua.dk