From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: supporting mouse-entered, mouse-left Date: Sat, 1 Aug 2009 00:26:46 -0700 Message-ID: <7AECD8D943404149AC60780F52B5B28F@us.oracle.com> References: <9c768dc60907310013o7226f1d5w4cde4c54b03eb474@mail.gmail.com> <0C3F67DE39BD414B9E7D825BA8D1F3F4@us.oracle.com> <87zlakdcic.fsf@uwakimon.sk.tsukuba.ac.jp> <8F83745376C049F683731B07431703F7@us.oracle.com> <9c768dc60907311357t63c725c1sa8d90c74514532f4@mail.gmail.com> <2CD05755045E4C60877DA54CC13E7D9D@us.oracle.com> <9c768dc60907312252k7bf800b8t453669b2ca2a6067@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249111749 5040 80.91.229.12 (1 Aug 2009 07:29:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2009 07:29:09 +0000 (UTC) Cc: "'Stephen J. Turnbull'" , emacs-devel@gnu.org To: "'Steve Yegge'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 01 09:29:02 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 1MX8zj-00063T-UE for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2009 09:27:08 +0200 Original-Received: from localhost ([127.0.0.1]:54051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX8zi-0005NN-TZ for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2009 03:27:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MX8zc-0005N6-Rb for emacs-devel@gnu.org; Sat, 01 Aug 2009 03:27:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MX8zY-0005Ms-Dl for emacs-devel@gnu.org; Sat, 01 Aug 2009 03:27:00 -0400 Original-Received: from [199.232.76.173] (port=39941 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX8zY-0005Mp-7C for emacs-devel@gnu.org; Sat, 01 Aug 2009 03:26:56 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:32601) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MX8zX-0003Jf-Kl for emacs-devel@gnu.org; Sat, 01 Aug 2009 03:26:55 -0400 Original-Received: from rcsinet12.oracle.com ([148.87.113.124] helo=rgminet12.oracle.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MX8zU-0005Ml-Rg for emacs-devel@gnu.org; Sat, 01 Aug 2009 03:26:53 -0400 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n717Ql5U007478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 1 Aug 2009 07:26:48 GMT Original-Received: from abhmt007.oracle.com (abhmt007.oracle.com [141.146.116.16]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n717QlNW001377; Sat, 1 Aug 2009 07:26:47 GMT Original-Received: from dradamslap1 (/141.144.98.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 01 Aug 2009 00:26:45 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <9c768dc60907312252k7bf800b8t453669b2ca2a6067@mail.gmail.com> Thread-Index: AcoSbFSubAhm3ruGR5Opm1EsjiOGhwABfFFg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt007.oracle.com [141.146.116.16] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010205.4A73EE36.0162:SCFSTAT5015188,ss=1,fgs=0 X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 1) 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:113507 Archived-At: >> 2. A way to know when the mouse is over any such text. >> ... >> 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. > > My question is #2, and your solution does not work. Emacs does > not send any notifications when the mouse moves unless track-mouse > is on. Right, for a mouseover you would need to use tracking (or write some C code, as you mentioned). You seemed to say you could not use tracking (or perhaps did not want to use it). Using `post-command-hook' as I suggested is quite sufficient if you are willing to click the spot to check instead of just mousing over it. This simple code highlights all occurrences of the property when any such occurrence is clicked, and unhighlights them all when you click anywhere else: (defun foo (prop value &optional start end face type) (unless face (setq face 'highlight)) (unless type (setq type 'overlay)) (when (string-match "mouse" (format "%S" (event-basic-type last-command-event))) (let* ((estart (event-start last-command-event)) (pos (posn-point estart))) (when (integer-or-marker-p pos) (save-excursion (with-current-buffer (window-buffer (posn-window estart)) (if (eq (get-char-property pos prop) value) (hlt-highlight-property-with-value prop (list value) start end face type) (hlt-unhighlight-region-for-face face start end)))))))) (defun foobar () (foo 'mouse-face 'highlight)) (add-hook 'post-command-hook 'foobar) Try it in *Help* or Dired, for instance, to show/hide all links at once. But if, as you now added, you do not really want to, as you said before, "light up" all such occurrences, then just substitute your code to "squeak audibly, like mice" for the hook function. Or tomorrow, if you want to send up balloons instead, put your balloon machine on the hook. Or not.