all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Steve Yegge <stevey@google.com>
Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
Subject: Re: supporting mouse-entered, mouse-left
Date: Sat, 01 Aug 2009 13:07:00 +0900	[thread overview]
Message-ID: <87vdl8ch3v.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com>

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?

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

 > I can't use track-mouse,

*sigh*

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

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

If you want to test the "any motion" interface now, XEmacs has
`mode-motion-hook' which handles all mouse motion events.  Eg,

(defvar sjt/counter 0)
(add-hook 'mode-motion-hook
          (lambda (ignored)
            (message "got one! (%d)")
            (incf sjt/counter)))

immediately starts counting of motion events.  Unfortunately, your
mode may not work in XEmacs without a fair amount of extra work due to
a lot of divergence in the last couple of years, but you could hack up
a test buffer with appropriate extents and stuff and see whether the
flashing is attractive or distractive.

`mode-motion-hook' is a variable declared in Lisp.
  -- loaded from "/playpen/src/XEmacs/xemacs/+optimized/lisp/mode-motion.elc"

Value: nil

Setting it would make its value buffer-local.

Documentation:
Function or functions which are called whenever the mouse moves.
Each function must take a single argument of the motion event.
You should normally use this rather than `mouse-motion-handler', which 
does some additional window-system-dependent things.  This hook is local
to every buffer, and should normally be set up by major-modes which want
to use special highlighting.  Every time the mouse moves over a window,
the mode-motion-hook of the buffer of that window is run.

 > I'll take a look at implementing it when I get some time.  I just
 > wanted to vet the idea with the list to make sure I wouldn't be
 > wasting my time.

It's been used in Lucid Emacs and XEmacs for over ten and probably
more than 15 years with success.  I see no reason why it shouldn't
be adopted in Emacs as well.





  parent reply	other threads:[~2009-08-01  4:07 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
2009-08-01  5:52             ` Steve Yegge
2009-08-01  7:26               ` Drew Adams
2009-08-01  4:07           ` Stephen J. Turnbull [this message]
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

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

  git send-email \
    --in-reply-to=87vdl8ch3v.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.