From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: set-temporary-overlay-map doesn't work for me Date: Wed, 27 Nov 2013 14:00:52 -0800 (PST) Message-ID: <4ecc8b65-0f0f-49c4-a32e-a58d6efc8d38@default> References: <87y549y1g6.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1385589684 4407 80.91.229.3 (27 Nov 2013 22:01:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Nov 2013 22:01:24 +0000 (UTC) To: Andrey Tykhonov , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 27 23:01:29 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VlnAl-0008Jr-1i for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 23:01:27 +0100 Original-Received: from localhost ([::1]:37990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlnAk-00038Y-NE for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 17:01:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlnAR-00037O-7t for help-gnu-emacs@gnu.org; Wed, 27 Nov 2013 17:01:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlnAI-0003Ah-JG for help-gnu-emacs@gnu.org; Wed, 27 Nov 2013 17:01:07 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:30385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlnAI-0003A5-Br for help-gnu-emacs@gnu.org; Wed, 27 Nov 2013 17:00:58 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rARM0sJW008992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Nov 2013 22:00:55 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rARM0r6q002850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Nov 2013 22:00:53 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rARM0rjo002838; Wed, 27 Nov 2013 22:00:53 GMT In-Reply-To: <87y549y1g6.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94684 Archived-At: > (defun my-temp () > (interactive) > (set-temporary-overlay-map > (let ((map (make-sparse-keymap))) > (define-key map [mouse-1] 'my-mouse-down) > map))) >=20 > (defun my-mouse-down () > (interactive) > (message "Word is: %s " (thing-at-point 'word))) >=20 > I evaluate them, then M-x my-temp RET, then mouse click (left button) on > "interactive" world and I'm expecting to see "Word is "interactive"" > message in the minibuffer. But no messages appear! `my-temp' does not read your mouse click. It binds the keymap, and then it exits. And then you click your mouse, with the binding no longer in effect. One approach would be to read an event inside your `my-temp', and ignore it if not a mouse click. To do something cleaner than that we would need to see the overall context - what you really want to do. But if this is all there is, then it seems you want to invoke a command (why a command?) that reads an event, and if that event is a mouse click then invoke `my-mouse-down'. Or perhaps you want to read events until you get a mouse click event... Anyway, that's the problem. Either describe what you really need or work it out knowing what this problem is.