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: Improving X selection? Date: Sat, 2 Feb 2008 00:17:00 +0000 Message-ID: <8e24944a0802011617k66c49283id9478dc3d5168bdf@mail.gmail.com> References: <8e24944a0710161629r1ec1afadj60352dc92c264217@mail.gmail.com> <8e24944a0801281152w733c977akda93089a52701219@mail.gmail.com> <8e24944a0801281659sa5a9115rf4533184413a8b20@mail.gmail.com> <8e24944a0802011115h77423fd1p2eae15a1e46bca1a@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_33273_8404981.1201911420646" X-Trace: ger.gmane.org 1201911438 6899 80.91.229.12 (2 Feb 2008 00:17:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2008 00:17:18 +0000 (UTC) To: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 02 01:17:39 2008 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.50) id 1JL64f-0006ST-Ly for ged-emacs-devel@m.gmane.org; Sat, 02 Feb 2008 01:17:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JL64D-0008Ip-Oq for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2008 19:17:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JL649-0008IY-Rx for emacs-devel@gnu.org; Fri, 01 Feb 2008 19:17:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JL648-0008IA-PF for emacs-devel@gnu.org; Fri, 01 Feb 2008 19:17:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JL648-0008I7-MI for emacs-devel@gnu.org; Fri, 01 Feb 2008 19:17:04 -0500 Original-Received: from wx-out-0506.google.com ([66.249.82.226]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JL648-0004Nh-GS for emacs-devel@gnu.org; Fri, 01 Feb 2008 19:17:04 -0500 Original-Received: by wx-out-0506.google.com with SMTP id s7so1347309wxc.24 for ; Fri, 01 Feb 2008 16:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=ISuUM+g5etLTVIEDKoscRu7WVdQh4HVNxJcmsiauLw8=; b=B6tx+yw7kccSH6S9jpyQl8oFD65gYGHvRQ7fSkUm+pJVaIVQ7HsEUL2/5e2Qr/QsoeS3cKtv2qwXetTywaeYYNoH337BYW0ntt1dbzIBTjc/w8JySyfBEwM5taufsARzm8m9z+FWETUqJW8Te3TwIA2xpDwoO1WO5+c2/IejdPU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=doE48OaNo/jIfmIktfcgMS4oLZynTaRuA/rYxp/THcP9kRYNxWLqyRbPeRgyNKQQ3ropYzQLi5TVB+7U3cnsp8g9vc3oJaMZx9khBncSfLLHPJGCrmmmNvogF5lnu8xt1SSZwmdqIgR5vfh02wcFZh4Q5Mr6OoZsBJnl9++fW70= Original-Received: by 10.142.239.11 with SMTP id m11mr2657298wfh.76.1201911420660; Fri, 01 Feb 2008 16:17:00 -0800 (PST) Original-Received: by 10.142.111.4 with HTTP; Fri, 1 Feb 2008 16:17:00 -0800 (PST) In-Reply-To: <8e24944a0802011115h77423fd1p2eae15a1e46bca1a@mail.gmail.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:87968 Archived-At: ------=_Part_33273_8404981.1201911420646 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 01/02/2008, David De La Harpe Golden wrote: > Another mail to follow about making select-active-regions work. Problem with select-active-regions is obvious: if you want it to work with both keyboard and mouse, it's not enough to reset the x11 selection when the mark is reset, it needs to be reset when the point is reset too, or the selection and active region will drift out of sync until the next mark reset. All well and good, but how to fix it? Well, I can naively introduce post-point-motion function (as attached*), but it's kind of intrusive and a potential performance problem, though probably unnoticeable on modern/fast machines/networks. There might be a better way to do it? (I thought about propagating selection when idle, but sudden selection inaccuracy when you go too fast would be annoying. post-command-hook doesn't work either (I think). Not sure how else to do it.) * Note that I'm not really up to speed on emacs internals, especially the C side and GC requirements when calling lisp from C. (Some mouse.el interactions need additional options too I think - yet another mail to follow with them...) ------=_Part_33273_8404981.1201911420646 Content-Type: text/x-diff; name=select-active-regions-when-point-moves-too.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_fc5evwt3 Content-Disposition: attachment; filename=select-active-regions-when-point-moves-too.diff ZGlmZiAtTmFyVSAxMCBlbWFjcy1leHMvbGlzcC9zaW1wbGUuZWwgZW1hY3MvbGlzcC9zaW1wbGUu ZWwKLS0tIGVtYWNzLWV4cy9saXNwL3NpbXBsZS5lbAkyMDA4LTAyLTAxIDIyOjQwOjMxLjAwMDAw MDAwMCArMDAwMAorKysgZW1hY3MvbGlzcC9zaW1wbGUuZWwJMjAwOC0wMi0wMSAyMzozMTo1Mi4w MDAwMDAwMDAgKzAwMDAKQEAgLTMzNDAsMjAgKzMzNDAsNjMgQEAKICAgICh0cmFuc2llbnQtb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ob29rcykgJiYKKyAgICAgIEZVTkNUSU9OUCAoaW50ZXJu ICgicG9zdC1wb2ludC1tb3Rpb24iKSkpCisgICAgY2FsbDAgKGludGVybiAoInBvc3QtcG9pbnQt bW90aW9uIikpOworICAKIH0KIAwKIC8qIE1vdmUgcG9pbnQgdG8gUE9TSVRJT04sIHVubGVzcyBQ T1NJVElPTiBpcyBpbnNpZGUgYW4gaW50YW5naWJsZQogICAgc2VnbWVudCB0aGF0IHJlYWNoZXMg YWxsIHRoZSB3YXkgdG8gcG9pbnQuICAqLwogCiB2b2lkCiBtb3ZlX2lmX25vdF9pbnRhbmdpYmxl IChwb3NpdGlvbikKICAgICAgaW50IHBvc2l0aW9uOwogewogICBMaXNwX09iamVjdCBwb3M7Cg== ------=_Part_33273_8404981.1201911420646--