From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.bugs,gmane.emacs.devel Subject: RE: select and META key Date: Wed, 28 Mar 2007 11:46:40 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1175053618 31083 80.91.229.12 (28 Mar 2007 03:46:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Mar 2007 03:46:58 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, emacs-devel@gnu.org To: herberteuler@hotmail.com, alinsoar@voila.fr Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 28 05:46:50 2007 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 1HWP7Z-0004H5-Js for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Mar 2007 05:46:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HWP9z-0001nG-Mg for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Mar 2007 22:49:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HWP9x-0001mp-D8 for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2007 23:49:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HWP9u-0001md-Ub for bug-gnu-emacs@gnu.org; Tue, 27 Mar 2007 23:49:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HWP9u-0001mZ-NU; Tue, 27 Mar 2007 22:49:14 -0500 Original-Received: from bay0-omc1-s25.bay0.hotmail.com ([65.54.246.97]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HWP7T-0001yX-S8; Tue, 27 Mar 2007 23:46:44 -0400 Original-Received: from hotmail.com ([65.55.154.102]) by bay0-omc1-s25.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Tue, 27 Mar 2007 20:46:42 -0700 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 27 Mar 2007 20:46:42 -0700 Original-Received: from 65.55.154.123 by by143fd.bay143.hotmail.msn.com with HTTP; Wed, 28 Mar 2007 03:46:40 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: X-OriginalArrivalTime: 28 Mar 2007 03:46:42.0285 (UTC) FILETIME=[B2CE79D0:01C770EB] X-detected-kernel: Windows 2000 SP4, XP SP1+ 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:15642 gmane.emacs.devel:68697 Archived-At: >However, there is surely a bug. Since you press the Meta key >only before releasing mouse-1, the event is slightly different from >pressing the Meta key before pressing mouse-1: in the former >case the first event is `down-mouse-1', and in the latter the >first event is `M-down-mouse-1'. Although the outcome is the >event `M-drag-mouse-1' in both cases, `mouse-drag-secondary' >seems not to get executed and other secondary selection >relating commands, such as `mouse-yank-secondary' fails to be >executed. I solved the bug, more or less. To reproduce the bug, follow these steps: 1. Run Emacs in a window system and switch to the *scratch* buffer. 2. Press mouse-1. 3. Drag the mouse to somewhere else, and press the Meta key. With keeping mouse-1 pressed in the whole progress. 4. Now release mouse-1 with holding the Meta key. You will see the secondary selection is made. 5. Move point to the end of the *scratch* buffer, and press M-mouse-2. Although there are secondary selected text (showed by an overlay in the *scratch* buffer), you cannot yank it at all. This is because when `mouse-set-secondary' gets executed when a `M-drag-mouse-1' event is generated at the end of the above steps, the `SECONDARY' property of symbol `x-selections' is not set correctly (actually it is nil). The below patch solves the problem. *** mouse.el.~1.241.8.44.~ 2007-03-19 09:11:41.000000000 +0800 --- mouse.el 2007-03-28 11:26:41.000000000 +0800 *************** *** 1522,1528 **** (with-current-buffer (window-buffer (posn-window posn)) (if (numberp (posn-point posn)) (setq beg (posn-point posn))) ! (move-overlay mouse-secondary-overlay beg (posn-point end))))) (defun mouse-drag-secondary (start-event) "Set the secondary selection to the text that the mouse is dragged over. --- 1522,1532 ---- (with-current-buffer (window-buffer (posn-window posn)) (if (numberp (posn-point posn)) (setq beg (posn-point posn))) ! (move-overlay mouse-secondary-overlay beg (posn-point end)) ! (x-set-selection ! 'SECONDARY ! (buffer-substring (overlay-start mouse-secondary-overlay) ! (overlay-end mouse-secondary-overlay)))))) (defun mouse-drag-secondary (start-event) "Set the secondary selection to the text that the mouse is dragged over. However, there are several questions I want to ask: [1] Is the patch appropriate? Although I have tested it, it may cause other potential problems. [2] I do not read all code in mouse.el. Are there other possible problems like this one? Thanks. Regards, Guanpeng Xu _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/