From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: supporting mouse-entered, mouse-left Date: Sat, 01 Aug 2009 13:07:00 +0900 Message-ID: <87vdl8ch3v.fsf@uwakimon.sk.tsukuba.ac.jp> References: <9c768dc60907310013o7226f1d5w4cde4c54b03eb474@mail.gmail.com> <0C3F67DE39BD414B9E7D825BA8D1F3F4@us.oracle.com> <87zlakdcic.fsf@uwakimon.sk.tsukuba.ac.jp> <8F83745376C049F683731B07431703F7@us.oracle.com> <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249099159 17251 80.91.229.12 (1 Aug 2009 03:59:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2009 03:59:19 +0000 (UTC) Cc: Drew Adams , emacs-devel@gnu.org To: Steve Yegge Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 01 05:59:12 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MX5kV-0003eA-HX for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2009 05:59:11 +0200 Original-Received: from localhost ([127.0.0.1]:35610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX5kU-00037y-Qn for ged-emacs-devel@m.gmane.org; Fri, 31 Jul 2009 23:59:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MX5ih-0001eY-RW for emacs-devel@gnu.org; Fri, 31 Jul 2009 23:57:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MX5ic-0001b4-Vg for emacs-devel@gnu.org; Fri, 31 Jul 2009 23:57:19 -0400 Original-Received: from [199.232.76.173] (port=59411 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX5ic-0001at-Lq for emacs-devel@gnu.org; Fri, 31 Jul 2009 23:57:14 -0400 Original-Received: from mtps01.sk.tsukuba.ac.jp ([130.158.97.223]:55068) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MX5ib-0004fu-Ou for emacs-devel@gnu.org; Fri, 31 Jul 2009 23:57:14 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps01.sk.tsukuba.ac.jp (Postfix) with ESMTP id 4FB241537C0; Sat, 1 Aug 2009 12:57:11 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 4299F1A27C1; Sat, 1 Aug 2009 13:07:00 +0900 (JST) In-Reply-To: <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com> X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta29) "garbanzo" 5bbff3553494+ XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:113498 Archived-At: 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.