From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nathaniel Flath Newsgroups: gmane.emacs.devel Subject: Re: Overalays and point-entered Date: Wed, 16 Sep 2009 16:46:33 -0400 Message-ID: <5e3a506e0909161346w1d5a8bebp84f1d51f0f446f28@mail.gmail.com> References: <5e3a506e0909101709u2259d56h25f3ef1ec67326aa@mail.gmail.com> <5e3a506e0909101902h72747299u2e306830ce63b11d@mail.gmail.com> <5e3a506e0909102108h381957cahfcaa681baa4abf@mail.gmail.com> <5e3a506e0909130947m1669cda0y25d13a5e8dcd85df@mail.gmail.com> <5e3a506e0909140810r38a83a84l387fb6bafeb962c1@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=000e0cd295108f219b0473b7fe9f X-Trace: ger.gmane.org 1253134762 25932 80.91.229.12 (16 Sep 2009 20:59:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Sep 2009 20:59:22 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 16 22:59:15 2009 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 1Mo1al-0005HH-2B for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2009 22:59:07 +0200 Original-Received: from localhost ([127.0.0.1]:59254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo1ak-0006bW-Jh for ged-emacs-devel@m.gmane.org; Wed, 16 Sep 2009 16:59:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mo1Oj-0005ve-9j for emacs-devel@gnu.org; Wed, 16 Sep 2009 16:46:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mo1Oe-0005tf-RF for emacs-devel@gnu.org; Wed, 16 Sep 2009 16:46:40 -0400 Original-Received: from [199.232.76.173] (port=47260 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo1Oe-0005tM-Ef for emacs-devel@gnu.org; Wed, 16 Sep 2009 16:46:36 -0400 Original-Received: from mail-px0-f198.google.com ([209.85.216.198]:59110) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mo1Od-0004Lm-Md for emacs-devel@gnu.org; Wed, 16 Sep 2009 16:46:36 -0400 Original-Received: by pxi36 with SMTP id 36so4244427pxi.6 for ; Wed, 16 Sep 2009 13:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=UW+guv6bdhAH/jz3HjRRQlTDewxE+2i995pTxPaffoY=; b=TRwf9G22xoFvEDr3Q2QxAiOW/0g6Z/j10I+RIu7sCT1cxi5P13YzIsdEIx0Hmm2oTC ks+JcRtbs6gs4m6vbQ2Bjx/s+s2/U4SFYXxgotaTgYvAp79cXSS55CInWcvF2qjQtJ3t EDorIlVEBo54IUVBoDFAic61lAz5Y+t2uTyAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=RbLOlz6pXgbWE4K3/piuReVFcClmM1IsgKecJVBkzpWUkIs9MgNBI5A/R0jE3JZLz+ q7O09NhJOqGWnurdEanjnKcLFf3LEuCGrzgShrBuU/gyJGwP+KryWAdDM+UgctCCb5s3 HlcywCwuKnOPVWgvql1mq5DfbnSYlEYYJLozo= Original-Received: by 10.140.131.2 with SMTP id e2mr1120210rvd.98.1253133993844; Wed, 16 Sep 2009 13:46:33 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/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:115397 Archived-At: --000e0cd295108f219b0473b7fe9f Content-Type: multipart/alternative; boundary=000e0cd295108f218f0473b7fe9d --000e0cd295108f218f0473b7fe9d Content-Type: text/plain; charset=ISO-8859-1 I wrote a patch to add point-left and point-entered to overlays. I ended up adding the implementation in command_loop_1. The patch is attached - let me know if anything needs to be fixed. Thanks, Nathaniel Flath On Mon, Sep 14, 2009 at 3:22 PM, Stefan Monnier wrote: > > By cursor motion, do you mean such as the cursor_to function in > terminal.c? > > No, not exactly. I mean more generally to trigger the code based on the > motion that happen from command to command. It could mean a hook in > something like cursor_to, but it could also mean a hook in > command_loop_1 (along the lines of what's done with > adjust_point_for_property. > > > Adding these hook to that function seems to behave similarly to when I > add > > them to the point motion commands, > > The different between point-motion and cursor-motion can only be seen > for operations that do a lot of internal movement. > E.g. diff-context->unified. Point-motion hooks will be triggered many > times during a run of diff-context->unified (and may accidentally cause > it to fail) whereas cursor motion hooks should only be triggered once > after the command is done, so it can't cause it to fail. > > > in that modes or commands that do not appear to move the cursor( any > > mode that traverses the buffer) will still trigger the hooks. > > If such a hook is run a bit more often than strictly needed, it's > usually not considered a bug (tho it is recognized as a misfeature). > So it might still be acceptable. > > > Stefan > --000e0cd295108f218f0473b7fe9d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I wrote a patch to add point-left and point-entered to overlays.=A0 I ended= up adding the implementation in command_loop_1.=A0 The patch is attached -= let me know if anything needs to be fixed.

Thanks,
Nathaniel Fla= th

On Mon, Sep 14, 2009 at 3:22 PM, Stefan Monn= ier <monni= er@iro.umontreal.ca> wrote:
> By cursor motion, do you mean such as the cursor_to = function in terminal.c?

No, not exactly. =A0I mean more generally to trigger the code based o= n the
motion that happen from command to command. =A0It could mean a hook in
something like cursor_to, but it could also mean a hook in
command_loop_1 (along the lines of what's done with
adjust_point_for_property.

> Adding these hook to that function seems to behave similarly to when I= add
> them to the point motion commands,

The different between point-motion and cursor-motion can only be seen=
for operations that do a lot of internal movement.
E.g. diff-context->unified. =A0Point-motion hooks will be triggered many=
times during a run of diff-context->unified (and may accidentally cause<= br> it to fail) whereas cursor motion hooks should only be triggered once
after the command is done, so it can't cause it to fail.

> in that modes or commands that do not appear to move the cursor( any > mode that traverses the buffer) will still trigger the hooks.

If such a hook is run a bit more often than strictly needed, it's=
usually not considered a bug (tho it is recognized as a misfeature).
So it might still be acceptable.


=A0 =A0 =A0 =A0Stefan

--000e0cd295108f218f0473b7fe9d-- --000e0cd295108f219b0473b7fe9f Content-Type: text/x-patch; charset=US-ASCII; name="overlay-properties.patch" Content-Disposition: attachment; filename="overlay-properties.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fzoiwywm0 LS0tIGEvc3JjL2tleWJvYXJkLmMKKysrIGIvc3JjL2tleWJvYXJkLmMKQEAgLTE5NzAsNSArMTk3 MCw2MyBAQCBjb21tYW5kX2xvb3BfMSAoKQoKICAgICBmaW5hbGl6ZToKCisgICAgICAvKiBSdW4g cG9pbnQtZW50ZXJlZCBhbmQgcG9pbnQtbGVmdCBob29rcyBmb3Igb3ZlcmxheXMgKi8KKyAgICAg IGlmIChOSUxQIChWaW5oaWJpdF9wb2ludF9tb3Rpb25faG9va3MpKQorICAgICAgICB7CisgICAg ICAgICAgaW50IGksIGo7CisgICAgICAgICAgaW50IG5vdmVybGF5c19jdXIsIG5vdmVybGF5c19w cmV2OworICAgICAgICAgIExpc3BfT2JqZWN0ICpvdmVybGF5X2N1cl92ZWM7CisgICAgICAgICAg TGlzcF9PYmplY3QgKm92ZXJsYXlfcHJldl92ZWM7CisgICAgICAgICAgZXh0ZXJuIExpc3BfT2Jq ZWN0IFFwb2ludF9lbnRlcmVkLCBRcG9pbnRfbGVmdCwgUXdpbmRvdzsKKyAgICAgICAgICBMaXNw X09iamVjdCBwb2ludF9sZWZ0LCBwb2ludF9lbnRlcmVkOworICAgICAgICAgIExpc3BfT2JqZWN0 IG92ZXJsYXlfd2luZG93OworCisgICAgICAgICAgR0VUX09WRVJMQVlTX0FUIChjdXJyZW50X2J1 ZmZlci0+cHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVybGF5X2N1cl92ZWMsCisg ICAgICAgICAgICAgICAgICAgICAgICAgICBub3ZlcmxheXNfY3VyLAorICAgICAgICAgICAgICAg ICAgICAgICAgICAgTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDApOworICAgICAg ICAgIEdFVF9PVkVSTEFZU19BVCAobGFzdF9wb2ludF9wb3NpdGlvbiwKKyAgICAgICAgICAgICAg ICAgICAgICAgICAgIG92ZXJsYXlfcHJldl92ZWMsCisgICAgICAgICAgICAgICAgICAgICAgICAg ICBub3ZlcmxheXNfcHJldiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAwKTsKKworICAgICAgICAgIC8qIEdvIHRocm91Z2ggZWFj aCBvdmVybGF5IHRoYXQgb3ZlcmxhcHBlZCBsYXN0X3BvaW50X3Bvc2l0aW9uIGFuZAorICAgICAg ICAgICAgIHJ1biBpdCdzIHBvaW50X2xlZnQgaG9vayBvbmx5IGlmIHRoZSBjdXJyZW50IGxvY2F0 aW9uIGlzIG5vdAorICAgICAgICAgICAgIG92ZXJsYXBwZWQgYnkgdGhhdCBvdmVybGF5LiAqLwor ICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBub3ZlcmxheXNfcHJldjsgaSsrKQorICAgICAgICAg ICAgeworICAgICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgbm92ZXJsYXlzX2N1cjsgaisrKQor ICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIGlmIChvdmVybGF5X3ByZXZfdmVj W2ldID09IG92ZXJsYXlfY3VyX3ZlY1tqXSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBuZXh0 X292ZXJsYXk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBwb2ludF9sZWZ0ID0g Rm92ZXJsYXlfZ2V0IChvdmVybGF5X3ByZXZfdmVjW2ldLCBRcG9pbnRfbGVmdCk7CisgICAgICAg ICAgICAgIG92ZXJsYXlfd2luZG93ID0gRm92ZXJsYXlfZ2V0IChvdmVybGF5X3ByZXZfdmVjW2ld LCBRd2luZG93KTsKKyAgICAgICAgICAgICAgaWYgKCFOSUxQIChwb2ludF9sZWZ0KQorICAgICAg ICAgICAgICAgICAgJiYgKE5JTFAgKG92ZXJsYXlfd2luZG93KQorICAgICAgICAgICAgICAgICAg ICAgIHx8ICFOSUxQIChGZXEgKG92ZXJsYXlfd2luZG93LCBGc2VsZWN0ZWRfd2luZG93KCkpKSkp CisgICAgICAgICAgICAgICAgY2FsbDIgKHBvaW50X2xlZnQsCisgICAgICAgICAgICAgICAgICAg ICAgIG1ha2VfbnVtYmVyIChsYXN0X3BvaW50X3Bvc2l0aW9uKSwKKyAgICAgICAgICAgICAgICAg ICAgICAgbWFrZV9udW1iZXIgKGN1cnJlbnRfYnVmZmVyLT5wdCkpOworCisgICAgICAgICAgICBu ZXh0X292ZXJsYXk6CisgICAgICAgICAgICAgIGkgPSBpOworICAgICAgICAgICAgfQorCisgICAg ICAgICAgLyogUnVuIHBvaW50X2VudGVyZWQgZnVuY3Rpb25zIGZvciBhbGwgb3ZlcmxheXMgb3Zl cmxhcHBpbmcgdGhlCisgICAgICAgICAgICAgY3VycmVudCBwb2ludCAqLworICAgICAgICAgIGZv ciAoaSA9IDA7IGkgPCBub3ZlcmxheXNfY3VyOyBpKyspCisgICAgICAgICAgICB7CisgICAgICAg ICAgICAgIHBvaW50X2VudGVyZWQgPSBGb3ZlcmxheV9nZXQgKG92ZXJsYXlfY3VyX3ZlY1tpXSwg UXBvaW50X2VudGVyZWQpOworICAgICAgICAgICAgICBvdmVybGF5X3dpbmRvdyA9IEZvdmVybGF5 X2dldCAob3ZlcmxheV9jdXJfdmVjW2ldLCBRd2luZG93KTsKKyAgICAgICAgICAgICAgaWYgKCFO SUxQIChwb2ludF9lbnRlcmVkKQorICAgICAgICAgICAgICAgICAgJiYgKE5JTFAgKG92ZXJsYXlf d2luZG93KQorICAgICAgICAgICAgICAgICAgICAgIHx8ICFOSUxQIChGZXEgKG92ZXJsYXlfd2lu ZG93LCBGc2VsZWN0ZWRfd2luZG93KCkpKSkpCisgICAgICAgICAgICAgICAgY2FsbDIgKHBvaW50 X2VudGVyZWQsIG1ha2VfbnVtYmVyIChsYXN0X3BvaW50X3Bvc2l0aW9uKSwgbWFrZV9udW1iZXIg KGN1cnJlbnRfYnVmZmVyLT5wdCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKICAgICAg IGlmIChjdXJyZW50X2J1ZmZlciA9PSBwcmV2X2J1ZmZlcgogCSAgJiYgbGFzdF9wb2ludF9wb3Np dGlvbiAhPSBQVAogCSAgJiYgTklMUCAoVmRpc2FibGVfcG9pbnRfYWRqdXN0bWVudCkK --000e0cd295108f219b0473b7fe9f--