From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: local keymap patch for key-binding Date: Wed, 13 Sep 2006 14:23:17 +0200 Message-ID: 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> <85hczdbdv2.fsf@lola.goethe.zz> <85mz959kkw.fsf@lola.goethe.zz> <85irjs4tda.fsf@lola.goethe.zz> <85ejug4pl4.fsf@lola.goethe.zz> <85k648kwy7.fsf@lola.goethe.zz> <85irjsj8s7.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 1158150305 25778 80.91.229.2 (13 Sep 2006 12:25:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Sep 2006 12:25:05 +0000 (UTC) Cc: cyd@stupidchicken.com, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 13 14:25:03 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 1GNTnF-0007fN-Lx for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 14:24:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNTnF-0001dK-21 for ged-emacs-devel@m.gmane.org; Wed, 13 Sep 2006 08:24:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GNTn3-0001d0-1s for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:24:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GNTmz-0001cU-Kc for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:24:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GNTmz-0001cR-Gu for emacs-devel@gnu.org; Wed, 13 Sep 2006 08:24:25 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GNTof-0003Ar-9s; Wed, 13 Sep 2006 08:26:09 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 6EDADA5003F; Wed, 13 Sep 2006 14:24:20 +0200 (CEST) Original-To: David Kastrup In-Reply-To: <85irjsj8s7.fsf@lola.goethe.zz> (David Kastrup's message of "Wed\, 13 Sep 2006 13\:38\:48 +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:59764 Archived-At: David Kastrup writes: > storm@cua.dk (Kim F. Storm) writes: > >> Your patch still looks good to me. > > Well, I could not witness any adverse effect after some testing, it > tracks the behavior of read-key-sequence closely. > > There is one concern that I have: the type of the "location" argument. > This currently is a key sequence. But it might make more sense to > turn this into the "location" data structure that `event-start' and/or > `event-end' return. This would make it much easier to feed lookup-key > with data produced from, say, `posn-at-x-y'. I overlooked that part -- I actually thought it was such a location. > In order to get this data easier, it might make sense to define a > convenience function. > > (defun key-event (key) > "Return event from moused-base key sequence KEY." > (and (vectorp key) > (if (consp (aref key 0)) > (aref key 0) > (and > (symbolp (aref key 0)) > (> (length key) 1) > (consp (aref key 1)) > (aref key 1))))) > > Maybe even in C, as this function can be executed without consing. That is usually not the normal way to decide what should be in C... > I found that the current usage in the help echo fixup stuff does not > even have a key sequence to start from, just a mouse position. > > So it would likely make more sense to rework the location argument > type to just be a mouse position. in pixels or chars? > That seems like the most basic unit for this argument that still makes > sense. True, but shouldn't it accept both types ... if you already have the full event, it seems wasteful to first convert it to just a mouse position, pass that to key-binding and then use that to derive what the original event was (eg. using posn-at-x-y). -- Kim F. Storm http://www.cua.dk