[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: supporting mouse-entered, mouse-left

From: Steve Yegge
Subject: Re: supporting mouse-entered, mouse-left
Date: Fri, 31 Jul 2009 22:52:51 -0700

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.


On Fri, Jul 31, 2009 at 5:56 PM, Drew Adams <address@hidden> 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

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.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]