From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#2044: marked as done (posn-point wrong when face-remapping-alist used) Date: Sun, 25 Jan 2009 17:10:10 +0000 Message-ID: References: <87d4ebz5d2.fsf@cyd.mit.edu> <33CE239F-C1F7-49E1-8678-29AE916EBDB8@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1232903410-21980-0" X-Trace: ger.gmane.org 1232904267 23440 80.91.229.12 (25 Jan 2009 17:24:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2009 17:24:27 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 25 18:25:40 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LR8jL-0000KD-AE for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2009 18:25:08 +0100 Original-Received: from localhost ([127.0.0.1]:45173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LR8i3-00086A-Fq for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2009 12:23:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LR8hq-00080W-1D for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2009 12:23:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LR8hp-0007zT-0K for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2009 12:23:33 -0500 Original-Received: from [199.232.76.173] (port=59495 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LR8ho-0007z2-Q7 for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2009 12:23:32 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:46295) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LR8ho-00031i-6h for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2009 12:23:32 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0PHNTOK025326; Sun, 25 Jan 2009 09:23:29 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0PHAANX022351; Sun, 25 Jan 2009 09:10:11 -0800 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: closed 2044 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24510 Archived-At: This is a multi-part message in MIME format... ------------=_1232903410-21980-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Sun, 25 Jan 2009 12:02:17 -0500 with message-id <87d4ebz5d2.fsf@cyd.mit.edu> and subject line Re: mouse position bug and half a fix has caused the Emacs bug report #2044, regarding posn-point wrong when face-remapping-alist used to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com immediately.) --=20 2044: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D2044 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems ------------=_1232903410-21980-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 25 Jan 2009 14:39:18 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0PEdE8K016213 for ; Sun, 25 Jan 2009 06:39:15 -0800 Received: from mail.gnu.org ([199.232.76.166]:34058 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LR67G-0002zp-R1 for emacs-pretest-bug@gnu.org; Sun, 25 Jan 2009 09:37:38 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LR68m-000324-Tb for emacs-pretest-bug@gnu.org; Sun, 25 Jan 2009 09:39:13 -0500 Received: from qw-out-1920.google.com ([74.125.92.144]:54016) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LR68m-000320-Ji for emacs-pretest-bug@gnu.org; Sun, 25 Jan 2009 09:39:12 -0500 Received: by qw-out-1920.google.com with SMTP id 4so1122817qwk.24 for ; Sun, 25 Jan 2009 06:39:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=T1PbpMHPOnNM1KcEuOgIRhQ40zZwXd5XlEQV7DzYyvE=; b=niKC8Zd7qW1kJ1hPKzj53V5CG/VZJ3+sN41uV9d/mlBUuVRD7INLooDNKfugjlpL60 RqUFVetO5BWeIwxC3ysP4TMI0Jbm4sDqLpRXW4V1/pErdkSZ8Ym6Jm9ogBBGEAkVXICw 2K+E4sNdvtbt8bDn84yAF9Xn19V5gclm6Ly7o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=ijybOCM41xuuT9jT+Rkhv8Gk7AXYkBncoZGie9jnDmg4iQfFVNTkmWPcGxLcr/chPK 0jh+l61aPu70IK76HJ1q7htWm5SR0ADfPWOMsMGeTkbt4jtX6fVWQkqMXgbzY4+XAuC1 2Uh7cFBCdgtq0KBxCtzTDjbrk5QnHW6Pcdst4= Received: by 10.214.148.5 with SMTP id v5mr7063982qad.312.1232894351634; Sun, 25 Jan 2009 06:39:11 -0800 (PST) Received: from scarlett.local (pool-71-162-19-14.pitbpa.east.verizon.net [71.162.19.14]) by mx.google.com with ESMTPS id 7sm15607092ywo.30.2009.01.25.06.39.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Jan 2009 06:39:10 -0800 (PST) Message-Id: <33CE239F-C1F7-49E1-8678-29AE916EBDB8@gmail.com> From: David Reitter To: emacs-pretest-bug@gnu.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: posn-point wrong when face-remapping-alist used Date: Sun, 25 Jan 2009 09:39:08 -0500 X-Mailer: Apple Mail (2.930.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Demonstration first: emacs -Q (split-window) (find-file "~/.emacs") ;; any file will do, or switch to another buffer (set (make-local-variable 'face-remapping-alist) '((default . variable- pitch))) The two buffers should now be shown in different faces. Now click (don't drag) into the windows, alternating between the two of them. You will see that various regions are marked, each of them between some seemingly arbitrary point near the mouse click (=mark), and the the point under the mouse. This shouldn't be. Instead, we would expect to only set the point, as is the case without the `face- remapping-alist' use above. This seems to happen whenever a click into a non-selected window is evaluated, and the faces differ in the two windows due to an entry in `face-remapping-alist'. Some analysis: The problem is that (posn-point (event-start start-event)) in mouse- drag-region does not give us the correct location; in fact, the xy coordinates in the event are wrong. My guess is that whatever algorithm determines the character position under the mouse cursor forgets to switch to the appropriate window buffer before looking up the faces when iterating over the window contents. I could probably fix this myself if I knew where this bit of code is... remember_mouse_glyph() probably doesn't have a part in this (because that one should work as is). For what its worth, I am using the code below (in xfaces.c) in some time-critical places to lookup a face in a buffer without having to make this buffer temporarily current. This may come in handy in order to fix this. int lookup_basic_face_for_buffer (f, face_id, buffer) struct frame *f; int face_id; Lisp_Object buffer; { Lisp_Object name, mapping; int remapped_face_id; Lisp_Object Vlocal_remapping_alist = Fbuffer_local_value (intern("face-remapping-alist"), buffer); if (NILP (Vlocal_remapping_alist)) return face_id; /* Nothing to do. */ switch (face_id) { case DEFAULT_FACE_ID: name = Qdefault; break; case MODE_LINE_FACE_ID: name = Qmode_line; break; case MODE_LINE_INACTIVE_FACE_ID: name = Qmode_line_inactive; break; case HEADER_LINE_FACE_ID: name = Qheader_line; break; case TOOL_BAR_FACE_ID: name = Qtool_bar; break; case FRINGE_FACE_ID: name = Qfringe; break; case SCROLL_BAR_FACE_ID: name = Qscroll_bar; break; case BORDER_FACE_ID: name = Qborder; break; case CURSOR_FACE_ID: name = Qcursor; break; case MOUSE_FACE_ID: name = Qmouse; break; case MENU_FACE_ID: name = Qmenu; break; default: abort (); /* the caller is supposed to pass us a basic face id */ } /* Do a quick scan through Vface_remapping_alist, and return immediately if there is no remapping for face NAME. This is just an optimization for the very common no-remapping case. */ mapping = assq_no_quit (name, Vlocal_remapping_alist); if (NILP (mapping)) return face_id; /* Give up. */ /* If there is a remapping entry, lookup the face using NAME, which will handle the remapping too. Avoid setting current buffer (slow). */ Lisp_Object old_face_remapping_alist = Vface_remapping_alist; Vface_remapping_alist = Vlocal_remapping_alist; remapped_face_id = lookup_named_face (f, name, 0, 0); Vface_remapping_alist = old_face_remapping_alist; if (remapped_face_id < 0) return face_id; /* Give up. */ return remapped_face_id; } ------------=_1232903410-21980-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 2044-done) by emacsbugs.donarmstrong.com; 25 Jan 2009 17:01:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: * X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=1.0 required=4.0 tests=GMAIL autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0PH1nHe019767 for <2044-done@emacsbugs.donarmstrong.com>; Sun, 25 Jan 2009 09:01:50 -0800 Received: by cyd.mit.edu (Postfix, from userid 1000) id D3EEE57E1D4; Sun, 25 Jan 2009 12:02:17 -0500 (EST) From: Chong Yidong To: David Reitter Cc: Emacs-Devel devel , 2044-done@emacsbugs.donarmstrong.com Subject: Re: mouse position bug and half a fix References: Date: Sun, 25 Jan 2009 12:02:17 -0500 In-Reply-To: (David Reitter's message of "Sat, 24 Jan 2009 22:15:13 -0500") Message-ID: <87d4ebz5d2.fsf@cyd.mit.edu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii David Reitter writes: > The problem is that (posn-point (event-start start-event)) in mouse- > drag-region does not give us the correct location; in fact, the xy > coordinates in the event are wrong. > > My guess is that whatever algorithm determines the character position > under the mouse cursor forgets to switch to the appropriate window > buffer before looking up the faces when iterating over the window > contents. I've checked in a fix. Thanks. ------------=_1232903410-21980-0--