From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.devel Subject: Re: mouse-yank-primary and bug #7699 Date: Wed, 22 Dec 2010 15:16:59 +0000 Message-ID: <4D12166B.8010002@harpegolden.net> References: <837hf2gc0p.fsf@gnu.org> <4D114EF0.8090706@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1293031039 7096 80.91.229.12 (22 Dec 2010 15:17:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 22 Dec 2010 15:17:19 +0000 (UTC) Cc: =?UTF-8?B?RGrDpHJ2?= , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 22 16:17:15 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PVQRD-0005XH-19 for ged-emacs-devel@m.gmane.org; Wed, 22 Dec 2010 16:17:11 +0100 Original-Received: from localhost ([127.0.0.1]:58908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVQRC-0006ru-Dm for ged-emacs-devel@m.gmane.org; Wed, 22 Dec 2010 10:17:10 -0500 Original-Received: from [140.186.70.92] (port=42724 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVQR7-0006r5-Hp for emacs-devel@gnu.org; Wed, 22 Dec 2010 10:17:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVQR6-0003dq-CP for emacs-devel@gnu.org; Wed, 22 Dec 2010 10:17:05 -0500 Original-Received: from harpegolden.net ([65.99.215.13]:53566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVQR4-0003cx-S4; Wed, 22 Dec 2010 10:17:03 -0500 Original-Received: from [87.198.55.89] (87-198-55-89.ptr.magnet.ie [87.198.55.89]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 6D8C3683D8; Wed, 22 Dec 2010 15:17:01 +0000 (GMT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101211 Icedove/3.0.11 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:133901 Archived-At: On 22/12/10 11:09, Eli Zaretskii wrote: > What is still unclear to me (but not entirely relevant to the issue at > hand in bug #7699) is why do we call x-get-selection at all, when > x-get-selection-value returns nil? (Bearing in mind that IMNHO mouse-yank-primary /shouldn't be/ calling=20 the current w32 x-get-selection-value): Remember that w32 x-get-selection-value follows the funny=20 interprogram-paste-function protocol intended for kill-ring interactions=20 that returns nil if the text has already been got. It _is_ w32's=20 interprogram-paste-function after all! So when you click mouse-2 on w32, you presently might get the clipboard,=20 or you might get the emulated primary, depending on fairly complex=20 (though deterministic) details of the interaction path leading up to the=20 mouse-2 click. If you were to remove the call to x-get-selection on w32,=20 you'd get the clipboard once (probably) and then nowt for subsequent=20 clicks. If you were to remove the call to x-get-selection-value that was=20 inserted, on w32 you should get the emulated primary on all clicks if it=20 is available, consistent with the function name "mouse-yank-primary",=20 and bearing in mind it might or might not currently be being updated=20 properly elsewhere on w32 (I haven't looked recently). But wait - why does X11 now have and call a function called=20 x-get-selection-value, then? It was introduced because someone amended=20 mouse-yank-primary to call the function called x-get-selection-value if=20 it existed (which at the time it only did on w32/dos), then someone else=20 decided to fix a bug by reusing the name and call site on x11. 2010-08-14 Eli Zaretskii * mouse.el (mouse-yank-primary): Fix mouse-2 on MS-Windows and MS-DOS. (Bug#6689) bzr diff -r101079..101080 2010-10-31 Jan Dj=C3=A4rv * term/x-win.el (x-get-selection-value): New function that gets PRIMARY with type as specified in x-select-request-type. (Bug#6802). bzr diff -r102166..102167 So x11 x-get-selection-value is a function with the same name as one on=20 w32 but very different behaviour, that always returns the primary value=20 if available, handling encodings. It is is _not_ X11's=20 interprogram-paste function (that's x-selection-value, "obviously"...). So a fallback to x11 x-get-selection if x11 x-get-selection-value=20 returns nothing on x11 is unnecessary but also fairly harmless in=20 mouse-yank-primary. > (I'm asking because my conclusion both from > reading the X implementation and from your responses, and also from > discussions archived in bugs #6635 and #6802, is that x-get-selection > is roughly a limited variant of x-get-selection-value, in that it > supports less data types. But I'm probably still missing something.) > x-get-selection is the (relatively) lowlevel x11-selection-thingy=20 getting function. Bearing in mind that I'm now talking about x11=20 selection thingies in general which are used to implement all sorts of=20 things, including the x11 clipboard and a bunch of other stuff, not just=20 "the" [primary] selection. i.e. x-get-selection is a more general lower-level x11-selection-thingy=20 getting function. x-get-selection-value is a less general higher-level=20 function that _only_ gets "the" [primary] selection (on x11! on w32 it's=20 a quite different function bound to the same name!), but handling=20 certain encoding issues. You'll find that x11 x-get-selection-value calls x11=20 x-selection-value-internal calls x11 x-get-selection. * removal of the x-get-selection-value call from mouse-yank-primary=20 would _now_ break x11, because of later changes mentioned above, but not=20 in some hard-to-fix manner.