From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: FW: mouse click on an overlay, using overlay `keymap' property Date: Fri, 21 Mar 2008 08:07:41 -0700 Message-ID: <003c01c88b65$4f9ff560$0600a8c0@us.oracle.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 1206112183 3292 80.91.229.12 (21 Mar 2008 15:09:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2008 15:09:43 +0000 (UTC) To: Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 21 16:10:12 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jcisk-0006C8-3q for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2008 16:10:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jcis9-0005Lo-Ir for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Mar 2008 11:09:33 -0400 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17744 Archived-At: 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.]