From unknown Fri Jun 20 07:20:25 2025 X-Loop: don@donarmstrong.com Subject: bug#71: FW: mouse click on an overlay, using overlay `keymap' property Reply-To: "Drew Adams" , 71@debbugs.gnu.org Resent-From: "Drew Adams" Original-Sender: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 21 Mar 2008 17:20:08 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 71 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.120611961724537 (code B ref -1); Fri, 21 Mar 2008 17:20:08 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=1.0 required=4.0 tests=AWL,IMPRONONCABLE_1, MURPHY_WRONG_WORD1,MURPHY_WRONG_WORD2,UNPARSEABLE_RELAY autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 21 Mar 2008 17:13:37 +0000 Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m2LHDR5a024526 for ; Fri, 21 Mar 2008 10:13:34 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEFALeJ40dMCrTo/2dsb2JhbACBWpA2mAI X-IronPort-AV: E=Sophos;i="4.25,536,1199682000"; d="scan'208";a="16357388" Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 21 Mar 2008 13:13:03 -0400 Received: from pastel.home ([76.10.180.232]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id BUI18703 for ; Fri, 21 Mar 2008 13:13:03 -0400 Received: by pastel.home (Postfix, from userid 20848) id E9C557F5D; Fri, 21 Mar 2008 13:13:02 -0400 (EDT) Resent-Message-ID: Resent-To: submit@debbugs.gnu.org Resent-From: Stefan Monnier Resent-Date: Fri, 21 Mar 2008 13:13:02 -0400 X-Original-To: monnier@iro.umontreal.ca Received: from pinpin.iro.umontreal.ca (pinpin.iro.umontreal.ca [132.204.24.52]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id C88C62CFAE0 for ; Fri, 21 Mar 2008 11:09:42 -0400 (EDT) Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by pinpin.iro.umontreal.ca (Postfix) with ESMTP id 1A9563B8B5B for ; Fri, 21 Mar 2008 11:09:38 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JcisD-0005Lo-Mx for monnier@iro.umontreal.ca; Fri, 21 Mar 2008 11:09:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jcis4-0005Lh-R0 for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2008 11:09:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jcis3-0005LM-RK for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2008 11:09:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jcis3-0005LJ-F3 for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2008 11:09:27 -0400 Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jcis2-0001MD-RQ for bug-gnu-emacs@gnu.org; Fri, 21 Mar 2008 11:09:27 -0400 Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m2LF9OHa029194 for ; Fri, 21 Mar 2008 10:09:24 -0500 Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m2L1GvTT012625 for ; Fri, 21 Mar 2008 09:09:23 -0600 Received: from inet-141-146-46-1.oracle.com by acsmt351.oracle.com with ESMTP id 3621646991206112060; Fri, 21 Mar 2008 08:07:40 -0700 Received: from dradamslap1 (/141.144.80.154) by bhmail.oracle.com (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 Mar 2008 08:07:40 -0700 From: "Drew Adams" To: Date: Fri, 21 Mar 2008 08:07:41 -0700 Message-ID: <003c01c88b65$4f9ff560$0600a8c0@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AciHvGjAlYZagBPJQAKIYSxe94mqxwDqI0bw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org Errors-To: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-1.94, requis 5, BAYES_00 -2.60, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00) X-DIRO-MailScanner-From: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org No one was able to explain this on emacs-devel. The only replies there indicate that this is an Emacs bug: `keymap' property doesn't work on an overlay, at least when there is also a `display' property present. -----Original Message----- From: Drew Adams Sent: Sunday, March 16, 2008 4:21 PM To: 'emacs- devel' Could someone please explain what's happening here, and why? How can I get the overlay's keymap to be in effect over all of the visual (displayed) area of the overlay? (setq foo-map (make-sparse-keymap)) (define-key foo-map [mouse-2] 'bar) (defun foo (beg end) (interactive "r") (let ((overlay (make-overlay beg end))) (overlay-put overlay 'display (propertize "xxxxxxxxx" 'face 'font-lock-constant-face)) (overlay-put overlay 'keymap foo-map))) (defun bar (event) (interactive "e") (message "BAR")) Here's some text: aaaaaaaaaaaaaaaaaaaaaaa Select one or more of the a's and do M-x foo, to apply the overlay to just those a's. Put point somewhere outside the displayed "xxxxxxxxx" overlay. Click mouse-2 anywhere on the displayed "xxxxxxxxx". What happens, it seems, is that, since point is not on the a's that have the overlay, keymap foo-map doesn't apply. Clicking mouse-2 therefore just calls the default mouse-2 binding, e.g. mouse-yank-at-click. That sets point so that it is at the beginning of the overlaid text, so that a second mouse-2 click on the displayed "xxxxxxxxx" does call bar. If that's what's happening, how can foo be defined so that a first click on the displayed "xxxxxxxxx" calls bar? I'm probably not understanding this well - help appreciated. I'm guessing that the mouse click on the overlay is noted not as being a click on a buffer position that has the overlay but on a buffer position that is under the displayed "xxxxxxxxx" but is actually outside the text that has the overlay. What I'm looking for is for the click to be perceived by Emacs as happening on the overlay, and for the overlay's keymap to apply over the full extent of the overlay, not just at its beginning, causing the overlay's keymap binding to take effect. [Note that I'm specifically asking about overlays here, not text properties. I know how to create clickable text using text properties.]