unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David De La Harpe Golden <david@harpegolden.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Djärv <jan.h.d@swipnet.se>, emacs-devel@gnu.org
Subject: Re: mouse-yank-primary and bug #7699
Date: Wed, 22 Dec 2010 15:16:59 +0000	[thread overview]
Message-ID: <4D12166B.8010002@harpegolden.net> (raw)
In-Reply-To: <E1PVMZ7-00036R-L9@fencepost.gnu.org>

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 
the current w32 x-get-selection-value):

Remember that w32 x-get-selection-value follows the funny 
interprogram-paste-function protocol intended for kill-ring interactions 
that returns nil if the text has already been got. It _is_ w32's 
interprogram-paste-function after all!

So when you click mouse-2 on w32, you presently might get the clipboard, 
or you might get the emulated primary, depending on fairly complex 
(though deterministic) details of the interaction path leading up to the 
mouse-2 click. If you were to remove the call to x-get-selection on w32, 
you'd get the clipboard once (probably) and then nowt for subsequent 
clicks.

If you were to remove the call to x-get-selection-value that was 
inserted, on w32 you should get the emulated primary on all clicks if it 
is available, consistent with the function name "mouse-yank-primary", 
and bearing in mind it might or might not currently be being updated 
properly elsewhere on w32 (I haven't looked recently).

But wait - why does X11 now have and call a function called 
x-get-selection-value, then?  It was introduced because someone amended 
mouse-yank-primary to call the function called x-get-selection-value if 
it existed (which at the time it only did on w32/dos), then someone else 
decided to fix a bug by reusing the name and call site on x11.

2010-08-14  Eli Zaretskii  <eliz@gnu.org>

	* 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ärv  <jan.h.d@swipnet.se>

	* 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 
w32 but very different behaviour, that always returns the primary value 
if available, handling encodings. It is is _not_ X11's 
interprogram-paste function (that's x-selection-value, "obviously"...).
So a fallback to x11 x-get-selection if x11 x-get-selection-value 
returns nothing on x11 is unnecessary but also fairly harmless in 
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 
getting function. Bearing in mind that I'm now talking about x11 
selection thingies in general which are used to implement all sorts of 
things, including the x11 clipboard and a bunch of other stuff, not just 
"the" [primary] selection.

i.e. x-get-selection is a more general lower-level x11-selection-thingy 
getting function. x-get-selection-value is a less general higher-level 
function that _only_ gets "the" [primary] selection (on x11! on w32 it's 
a quite different function bound to the same name!), but handling 
certain encoding issues.

You'll find that x11 x-get-selection-value calls x11 
x-selection-value-internal calls x11 x-get-selection.


* removal of the x-get-selection-value call from mouse-yank-primary 
would _now_ break x11, because of later changes mentioned above, but not 
in some hard-to-fix manner.




  reply	other threads:[~2010-12-22 15:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 19:29 mouse-yank-primary and bug #7699 Eli Zaretskii
2010-12-22  1:05 ` David De La Harpe Golden
2010-12-22  1:38   ` Drew Adams
2010-12-22  3:16     ` David De La Harpe Golden
2010-12-22  4:18       ` Drew Adams
2010-12-22 11:13         ` Eli Zaretskii
2010-12-22 15:11           ` Drew Adams
2010-12-22 19:04             ` Eli Zaretskii
2010-12-22 19:09               ` Drew Adams
2010-12-22 11:09   ` Eli Zaretskii
2010-12-22 15:16     ` David De La Harpe Golden [this message]
2010-12-22 15:38       ` David De La Harpe Golden
2010-12-22 19:23         ` Eli Zaretskii
2010-12-22 21:37           ` David De La Harpe Golden
2010-12-23  4:01             ` Eli Zaretskii
2010-12-22 19:17       ` Eli Zaretskii
2010-12-22 22:10         ` David De La Harpe Golden
2010-12-23  4:03           ` Eli Zaretskii
2010-12-23  7:32             ` Jan D.
2010-12-23  9:08               ` Eli Zaretskii
2010-12-23 14:28                 ` Stefan Monnier
2010-12-23 16:38                 ` David De La Harpe Golden
2010-12-22  6:47 ` Jan Djärv

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D12166B.8010002@harpegolden.net \
    --to=david@harpegolden.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).