On Fri, Jul 31, 2009 at 9:07 PM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
Steve Yegge writes:

 > 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,

Are you being imprecise here?  Surely you have already done this
"linking" for other reasons?

I appear to have inadvertently omitted the word "visually".  I meant:

"My goal is to link together _visually_ all the references to each local
variable,"

But you knew *exactly* what I meant already, based on your first
reply.  You're just being coy, and it's charming, but it's not fooling us.
 

 > so they light up when you mouse over any of them.

Ie, the only problem you are asking about here is to get the motion
event, and run a hook on that?

Aye.
 

 > I can't use track-mouse,

*sigh*

+1
 

 > or at least I don't think I can, since this feature needs to
 > trigger automatically as you move the mouse (from the idle loop).

Well, even if track-mouse doesn't do exactly what you want, it's not
clear to me that it's unusable.  I can think of two interfaces that
might serve:

(1) a minor mode where a click toggles the highlighting corresponding
   to the js2-mode text properties at the point of the click (no
   motion tracking needed), and

(2) a minor mode which is activated by a click (or popup menu
   selection), after which you can explicitly use track-mouse until
   the next non-motion event or something like that.  I don't think
   this kind of mouse-tracking would require huge amounts of code for
   what you've described, although there are few enough mouse clicks
   that you may already be using them all.

No clicks.  It's gotta work in unselected windows.  Clicks are a
deal-breaker.  Hell, I've already got it working when point enters
an identifier.  So clicking the mouse *already works*.

No clicks!
 

I think you do want some kind of activation, otherwise if any mouse
motion enables the effect we'd have to coin a term "apoplectic fruit
salad".

I'm fine with that term.  We can even name the hook after it, for
all I care.  But this isn't about what I want.  It's my users.  They *love*
this feature in my browser-based code navigation tool.  They drool
over it.  They demand it in Emacs... and who am I to deny them?
I'm afraid I don't have that kind of authority.  My hands are tied here.

So we're just gonna have to implement it.
 

If you want to test the "any motion" interface now, XEmacs has
`mode-motion-hook'

XEmacs... that's that VIM clone, isn't it?  Or was it SlickEdit?

In all seriousness, I'd love to go look, but if I'm going to implement
this feature in Emacs, I worry that I don't understand any of the
legal ramifications of not clean-rooming it.

If someone with the initials "rms" OKs it, then I'll look.  Otherwise,
I'll just take your word for it.  At least you've validated the idea
that it's useful.

-steve