From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: local keymap patch for key-binding Date: Mon, 11 Sep 2006 15:04:36 +0200 Message-ID: <85pse2h7vf.fsf@lola.goethe.zz> References: <87slj1hybl.fsf@stupidchicken.com> <85pse5cbqw.fsf@lola.goethe.zz> <87zmd7yjq4.fsf@furball.mit.edu> <85pse3n99c.fsf@lola.goethe.zz> <87r6yjxh7k.fsf@furball.mit.edu> <85venuc27c.fsf@lola.goethe.zz> <85r6yiivi7.fsf@lola.goethe.zz> <85ejuiiuh3.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157979917 11669 80.91.229.2 (11 Sep 2006 13:05:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Sep 2006 13:05:17 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 11 15:05:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GMlT4-0006SJ-SJ for ged-emacs-devel@m.gmane.org; Mon, 11 Sep 2006 15:04:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMlT4-0006H1-GC for ged-emacs-devel@m.gmane.org; Mon, 11 Sep 2006 09:04:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GMlSs-0006Gp-BL for emacs-devel@gnu.org; Mon, 11 Sep 2006 09:04:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GMlSr-0006GV-N8 for emacs-devel@gnu.org; Mon, 11 Sep 2006 09:04:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMlSr-0006GS-Iq for emacs-devel@gnu.org; Mon, 11 Sep 2006 09:04:41 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GMlU8-0000uG-Fq for emacs-devel@gnu.org; Mon, 11 Sep 2006 09:06:00 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1GMlSq-0007NZ-S1; Mon, 11 Sep 2006 09:04:41 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 11B6F1C40B5C; Mon, 11 Sep 2006 15:04:36 +0200 (CEST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Mon\, 11 Sep 2006 14\:53\:38 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:59672 Archived-At: storm@cua.dk (Kim F. Storm) writes: > David Kastrup writes: > >> Ok, here I triggered a problem: I used C-h k (with the new help.el) >> followed by a mouse-2 click on an overlay's 'before-string which has >> its own 'keymap and 'display properties (the string, not the overlay). >> >> I get >> >> Debugger entered--Lisp error: (args-out-of-range 806 806) >> key-binding([(mouse-2 (# 806 ... -61397984 ... 806 ... ... ... ...))] t) >> describe-key([(mouse-2 (# 806 ... -61397984 ... 806 ... ... ... ...))] 1 nil) >> call-interactively(describe-key) >> >> It would appear that 806 is the buffer position, and I would guess >> that this is erroneously used as in index into the before-string >> property of the overlay. > > I need a self-contained test-case to work on that. > And I need to know the full contents of the failing event. I found the problem already. However, contrary to Chong Yidong's assertion, a proper lookup dealing with keymap property, local-map property (which Chong does not check at all), correct use of overriding-local-map and overriding-terminal-local-map (which have to be consulted before the keymaps of the mouse event, but based on the buffer that the event happened in) is not as trivial as the current code would suggest. Also, the C-h k test masks some problems because it manually switches to the buffer where the event occured before looking it up, so we don't see the case where the event is not from the current window/buffer/terminal. I am currently trying to implement this correctly, based on (info "(elisp) Active Keymaps") and the code for read-key-sequence. I'll hopefully be through with this in a few hours. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum