unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Steve Yegge'" <stevey@google.com>
Cc: "'Stephen J. Turnbull'" <stephen@xemacs.org>, emacs-devel@gnu.org
Subject: RE: supporting mouse-entered, mouse-left
Date: Fri, 31 Jul 2009 17:56:41 -0700	[thread overview]
Message-ID: <2CD05755045E4C60877DA54CC13E7D9D@us.oracle.com> (raw)
In-Reply-To: <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com>

	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	other threads:[~2009-08-01  0:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-31  7:13 supporting mouse-entered, mouse-left Steve Yegge
2009-07-31 15:38 ` Drew Adams
2009-07-31 15:48   ` Steve Yegge
2009-07-31 16:48   ` Stephen J. Turnbull
2009-07-31 16:42     ` Drew Adams
2009-07-31 20:23       ` Drew Adams
2009-07-31 20:57         ` Steve Yegge
2009-08-01  0:56           ` Drew Adams [this message]
2009-08-01  5:52             ` Steve Yegge
2009-08-01  7:26               ` Drew Adams
2009-08-01  4:07           ` Stephen J. Turnbull
2009-08-01  6:04             ` Steve Yegge
2009-08-01  7:18               ` Stephen J. Turnbull
2009-07-31 19:16 ` Stefan Monnier
2009-07-31 22:05   ` Johan Bockgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2CD05755045E4C60877DA54CC13E7D9D@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=stephen@xemacs.org \
    --cc=stevey@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).