From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steve Yegge Newsgroups: gmane.emacs.devel Subject: Re: supporting mouse-entered, mouse-left Date: Fri, 31 Jul 2009 22:52:51 -0700 Message-ID: <9c768dc60907312252k7bf800b8t453669b2ca2a6067@mail.gmail.com> References: <9c768dc60907310013o7226f1d5w4cde4c54b03eb474@mail.gmail.com> <0C3F67DE39BD414B9E7D825BA8D1F3F4@us.oracle.com> <87zlakdcic.fsf@uwakimon.sk.tsukuba.ac.jp> <8F83745376C049F683731B07431703F7@us.oracle.com> <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com> <2CD05755045E4C60877DA54CC13E7D9D@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e645a3d8b2d5b004700e25a4 X-Trace: ger.gmane.org 1249108109 31063 80.91.229.12 (1 Aug 2009 06:28:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2009 06:28:29 +0000 (UTC) Cc: "Stephen J. Turnbull" , emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 01 08:28:21 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 1MX84q-0004cf-6X for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2009 08:28:21 +0200 Original-Received: from localhost ([127.0.0.1]:40036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX84p-0003nr-M3 for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2009 02:28:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MX7Wi-0004vi-NI for emacs-devel@gnu.org; Sat, 01 Aug 2009 01:53:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MX7Wc-0004q5-Qd for emacs-devel@gnu.org; Sat, 01 Aug 2009 01:53:03 -0400 Original-Received: from [199.232.76.173] (port=37172 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX7Wb-0004pd-VM for emacs-devel@gnu.org; Sat, 01 Aug 2009 01:52:58 -0400 Original-Received: from smtp-out.google.com ([216.239.33.17]:62733) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MX7Wa-0001NH-SB for emacs-devel@gnu.org; Sat, 01 Aug 2009 01:52:57 -0400 Original-Received: from zps36.corp.google.com (zps36.corp.google.com [172.25.146.36]) by smtp-out.google.com with ESMTP id n715qsEJ001383 for ; Sat, 1 Aug 2009 06:52:54 +0100 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1249105975; bh=PFZUmRNXVYrfrkPe3GKEV7Qg2sE=; h=DomainKey-Signature:MIME-Version:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:X-System-Of-Record; b=M bBGlxW6R01CtiHUCC4DfneOgq29Rrm6W2RudaP2pZ51bhNj2YSXNVNe9g6iDhQ3jNbF OhKRWnAUiepZRHW3BQ== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:date:message-id:subject:from:to: cc:content-type:x-system-of-record; b=ndhSmF7aUj60HxWMTFAeVUcwBU2tDYRo53cIhpjkee8DeS0dRQFjrvMZRSZjZ3awF 92s6SwZyRjad1KR9BKXWg== Original-Received: from yxe9 (yxe9.prod.google.com [10.190.2.9]) by zps36.corp.google.com with ESMTP id n715qp88019841 for ; Fri, 31 Jul 2009 22:52:51 -0700 Original-Received: by yxe9 with SMTP id 9so4332674yxe.30 for ; Fri, 31 Jul 2009 22:52:51 -0700 (PDT) Original-Received: by 10.100.196.17 with SMTP id t17mr3476901anf.20.1249105971172; Fri, 31 Jul 2009 22:52:51 -0700 (PDT) In-Reply-To: <2CD05755045E4C60877DA54CC13E7D9D@us.oracle.com> X-System-Of-Record: true X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Sat, 01 Aug 2009 02:27:20 -0400 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:113503 Archived-At: --0016e645a3d8b2d5b004700e25a4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit No, I do not need #1. This is not a question about highlighting. I most sincerely regret ever using the word "highlight", because it has sent you off chasing a massive red herring. Let's just pretend I never said I wanted them to highlight. I want them to squeak audibly, like mice. OK? I will figure out how to make that happen. By myself. My question is #2, and your solution does not work. Emacs does not send any notifications when the mouse moves unless track-mouse is on. This is what is called, in the vulgar parlance, a Catch-22. Stefan already understands my question and has given me a very satisfactory answer, which is, in short: go ahead and implement it. That is what I was hoping to hear. Before I start, I need to go poke fun at Stephen for acting like a user on a Mac OS X forum and telling me in great detail that I don't really want to do what I specifically said I want to do. -steve On Fri, Jul 31, 2009 at 5:56 PM, Drew Adams wrote: > The mode decorates the source with various text properties to > facilitate navigation, outlining, folding, etc. My goal is to link > together all the references to each local variable, so they light > up when you mouse over any of them. > > Sounds like you need two things: > > 1. A way to highlight all text that has some property with a given value. > 2. A way to know when the mouse is over any such text. > > For #2 I dunno. Maybe you can put something on `post-command-hook' (or you > might > need to do mouse-tracking). A function on `post-command-hook' could perhaps > check whether the last event was a mouse event, and if so get the mouse > position > and then the value of the property at that position. That could be costly, > but > it might get you started. > > For #1, I just added a command to highlight.el that does that. It should > give > you something that works while you look for something more appropriate, if > it > isn't exactly what you want. > > The new command is `hlt-highlight-property-with-value'. You give it the > property > and value to highlight. You can give it a list of possible values - if the > property has any of them, then the text is highlighted. > > You can also give it start and end limits, the highlighting face, the > highlighting type (overlay or text property or both), and whether the > highlighting should be with property `face' or `mouse-face'. All of these > args > are optional. > > To test the command: > > 1. Add a property to some text. For a quick test, you could add property > `mouse-face' with value `highlight' (e.g. just as a test) using `C-u M-x > hlt-highlight-regexp-region'. > > 2. Highlight all text that has a given property value. `M-x > hlt-highlight-property-with-value'. You are prompted for the property and > the > value. E.g., enter `mouse-face' for the property and `highlight' for its > value. > All text (in the region or buffer) that has property `mouse-face' with > value > `highlight' is highlighted. (See the file for how to unhighlight etc.) > > http://www.emacswiki.org/emacs/highlight.el > > HTH. > > --0016e645a3d8b2d5b004700e25a4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable No, I do not need #1.=A0 This is not a question about highlighting.
I mo= st sincerely regret ever using the word "highlight", because
i= t has sent you off chasing a massive red herring.

Let's just pre= tend I never said I wanted them to highlight.
I want them to squeak audibly, like mice.=A0 OK?=A0 I will figure out
ho= w to make that happen.=A0 By myself.

My question is #2, and your sol= ution does not work.=A0 Emacs does
not send any notifications when the m= ouse moves unless track-mouse
is on.=A0 This is what is called, in the vulgar parlance, a Catch-22.
Stefan already understands my question and has given me a
very satisfa= ctory answer, which is, in short:=A0 go ahead and implement
it.=A0 That = is what I was hoping to hear.

Before I start, I need to go poke fun at Stephen for acting like
a u= ser on a Mac OS X forum and telling me in great detail that I
don't = really want to do what I specifically said I want to do.

-steve

On Fri, Jul 31, 2009 at 5:56 PM, Drew Adams = <drew.adams@o= racle.com> wrote:
=A0 =A0 =A0 =A0The mode decorates the source with variou= s text properties to
=A0 =A0 =A0 =A0facilitate navigation, outlining, folding, etc. =A0My goal = is to link
=A0 =A0 =A0 =A0together all the references to each local variable, so they= light
=A0 =A0 =A0 =A0up when you mouse over any of them.

Sounds like you need two things:

1. A way to highlight all text that has some property with a given value. 2. A way to know when the mouse is over any such text.

For #2 I dunno. Maybe you can put something on `post-command-hook' (or = you might
need to do mouse-tracking). A function on `post-command-hook' could per= haps
check whether the last event was a mouse event, and if so get the mouse pos= ition
and then the value of the property at that position. That could be costly, = but
it might get you started.

For #1, I just added a command to highlight.el that does that. It should gi= ve
you something that works while you look for something more appropriate, if = it
isn't exactly what you want.

The new command is `hlt-highlight-property-with-value'. You give it the= property
and value to highlight. You can give it a list of possible values - if the<= br> property has any of them, then the text is highlighted.

You can also give it start and end limits, the highlighting face, the
highlighting type (overlay or text property or both), and whether the
highlighting should be with property `face' or `mouse-face'. All of= these args
are optional.

To test the command:

1. Add a property to some text. For a quick test, you could add property `mouse-face' with value `highlight' (e.g. just as a test) using `C-= u M-x
hlt-highlight-regexp-region'.

2. Highlight all text that has a given property value. `M-x
hlt-highlight-property-with-value'. You are prompted for the property a= nd the
value. E.g., enter `mouse-face' for the property and `highlight' fo= r its value.
All text (in the region or buffer) that has property `mouse-face' with = value
`highlight' is highlighted. (See the file for how to unhighlight etc.)<= br> HTH.


--0016e645a3d8b2d5b004700e25a4--