emacs-devel
[Top][All Lists]
Advanced

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

RE: supporting mouse-entered, mouse-left


From: Drew Adams
Subject: RE: supporting mouse-entered, mouse-left
Date: Fri, 31 Jul 2009 17:56:41 -0700

        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.





reply via email to

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